Whoever wrote the "Gloria" didn't expect this to happen.
The initial words of the Gloria are straight from the Bible and part of an angelic hymn to God on that first Christmas night.
Glory to God in the highest and on earth peace to those on whom his favor rests. (Luke 2:14)
However, after that line everything else was composed separately. Who composed it? There is no known author, but it can be traced back all the way to the third century. According to Joseph A. Jungmann in The Mass of the Roman Rite, “The Gloria, like the Kyrie, was not created originally for the liturgy of the Mass. It is an heirloom from the treasure of ancient Church hymns, a precious remnant of a literature now almost buried but once certainly very rich.”
Jungmann goes on to explain how the additional lines of the Gloria were part of a “literature of songs … written in the early Church in imitation of the biblical lyrics, especially the Psalms.” Furthermore, these early hymns were called psalmi idiotici, “psalms by private persons” and were not written for any particular liturgical use. Whoever wrote it was likely thinking of only one thing: praising God.
At first it was used in the East as a a morning hymn in the Little Hours of the Divine Office and later translated into Latin, according to tradition, by St. Hilary of Poitiers. Similarly it was initially used as a general hymn of thanksgiving and praise used outside of the main liturgical events.
Not surprisingly, one of the first instances of its use during the Mass was at the Mass of Christmas night, and then later it was added to Sundays and feasts of martyrs. As the centuries went by this particular hymn became more and more a central part of the Mass and was obligatory on certain days by the 5th century.
The current General Instruction of the Roman Missal explains its vital importance.
The Gloria in excelsis (Glory to God in the highest) is a most ancient and venerable hymn by which the Church, gathered in the Holy Spirit, glorifies and entreats God the Father and the Lamb. The text of this hymn may not be replaced by any other.
It is a glorious hymn, one where we are invited to complete the hymn of the angels and to add our voices in thanksgiving for everything that God has done for us.