Paul wrote a long passage of his 1 Corinthians letter to the topic of the tongues. He clarifies many issues regarding why this gift existed and why we know that it is not the glossolalia practiced by some religious.
(1 Corinthians 14:2-19)
2 For the one who speaks in a tongue speaks, not to men, but to God, for no one listens, but he speaks sacred secrets by the spirit. 3 However, the one who prophesies builds up and encourages and consoles men by his speech. 4 The one who speaks in a tongue builds up himself, but the one who prophesies builds up a congregation. 5 Now I would like for all of you to speak in tongues, but I prefer that you prophesy. Indeed, the one who prophesies is greater than the one who speaks in tongues, unless he interprets, so that the congregation may be built up. 6 But at this time, brothers, if I should come speaking to you in tongues, what good would I do you unless I spoke to you either with a revelation or with knowledge or with a prophecy or with a teaching?
7 It is the same with the inanimate things that produce sound, whether a flute or a harp. Unless there is an interval to the tones, how can what is being played on the flute or on the harp be recognized? 8 For if the trumpet sounds an indistinct call, who will get ready for battle? 9 In the same way, unless you with the tongue use speech that is easily understood, how will anyone know what is being said? You will, in fact, be speaking into the air. 10 It may be that there are many kinds of speech in the world, and yet no kind is without meaning. 11 For if I do not understand the sense of the speech, I will be a foreigner to the one speaking, and the one speaking will be a foreigner to me. 12 So also with you, since you eagerly desire the gifts of the spirit, seek to abound in gifts that will build up the congregation.
13 Therefore, let the one who speaks in a tongue pray that he may interpret. 14 For if I am praying in a tongue, it is my gift of the spirit that is praying, but my mind is unproductive. 15 What is to be done, then? I will pray with the gift of the spirit, but I will also pray with my mind. I will sing praise with the gift of the spirit, but I will also sing praise with my mind. 16 Otherwise, if you offer praise with a gift of the spirit, how will the ordinary person in your midst say “Amen” to your giving of thanks, since he does not know what you are saying? 17 True, you are giving thanks in a fine way, but the other man is not being built up. 18 I thank God that I speak in more tongues than all of you do. 19 Nevertheless, in a congregation I would rather speak five words with my mind, that I might also instruct others, than ten thousand words in a tongue. (...)
22 Therefore, tongues are not a sign for the believers but for the unbelievers, whereas prophecy is not for the unbelievers but for the believers. 23 So if the whole congregation comes together to one place and they all speak in tongues, but ordinary people or unbelievers come in, will they not say that you have lost your minds? 24 But if you are all prophesying and an unbeliever or an ordinary person comes in, he will be reproved and closely examined by them all. 25 The secrets of his heart then become evident, so that he will fall facedown and worship God, declaring: “God is really among you.”