We must first differentiate between Christmas "Carols", Christmas "songs", and Christmas Hymns. Many of the songs one hears at Christmas time are not actually Christmas carols. Especially "secular" songs, such as "Jingle Bells", "Frosty the Snowman", are not carols, but popular songs written on imaginatively generated texts. They invoke ideas and customs we have come to associate with the Season over many years, and are meant to heighten our enjoyment of the traditions we have come to celebrate societally.
Even songs such as "I'm Dreaming of a White Christmas", "The First Snowfall of the Winter", "Walking in a Winter Wonderland", etc., are not Christmas carols. Many are individually composed for commercial purposes, and many are from movies such as "Holiday Inn". This does not lessen their value and their position in popular music. It is simply that they are to be distinguished from carols, about which you have inquired.
Carols, technically, are those vocal pieces which were originally meant as teaching agents. In Medieval times, very few persons were literate. They were not able to read the scriptures for themselves, nor, as a matter of fact, were they allowed to do so, even if capable. The Church saw the reading of Scripture as a function of the clergy, who were also the only persons who had access to the Bible before the invention of the printing press.
We must also remember that the Scriptures were generally read in Latin, despite the fact that Latin was no longer the lingua franca of those who listened to the reading of same. To enable the laity to be taught the stories of the Bible and the beliefs of the Church, several devices came into use. Stained glass windows, for example, depicted scenes from the Bible, which could be explained to lay persons in their own language. They were then reminded of the stories, and their attendant meanings, when they viewed the windows.
Similarly, stories, primarily of the advent and birth of Jesus, were taught by the singing of songs which told the story, although there are also carols for Easter. The carols were composed in popular styles, accompanied often by drums, primitive flutes (such as recorders), and brought to the attention of the public through performances much like a traveling show of earlier days in our own country.
Themes from the Old Testament, such as that stating that Jesus was the "Second Adam", were taught in such carols as "Adam lay y-bounded". Seeing the Christ Child as a winter-blooming rose was taught with "Lo! How a Rose E'er-Blooming". Some of these, called "macaronic carols", featured the native language, with interspersions of short, Latin phrases, such as "Gaudeamus" (meaning "let us praise"), or "Adoramus Dominus" ("Let us adore the Lord"), which the people heard often in church.
Therefore, the purpose of Christmas carols, in direct response to your question, was originally as a device for teaching. Over the centuries, the original use was not abandoned, but added to, by simple ideas of joy, wonder, mystery, and gratitude. In our present day, carols are often un-distinguished from other seasonal songs, which are largely imbued with the same intent, whether it be sacred or secular.
I mentioned above that Christmas carols are often thought of in the same vein as Christmas hymns. The difference lies primarily in the fact that Carols were originally in a popular idiom, much like the "street music" of the day. That is to say, the dance rhythms of the time were adopted and adapted for religious purposes. The people were familiar with such music, and could, therefore, be "enticed" to the learning of Christian ideals through its use. In actuality, we find the same process today, as is witnessed to by the fact that we can hear music which, at first, sounds like any other "rock" or popular music on the radio, CD's, etc. Only after listening carefully to the words do we find that they carry a Christian message.
On the other hand, Christmas Hymns are more akin to the traditional hymnody of the Church, based largely on Lutheran Chorales by Bach(1685-1750), or on Victorian hymns. These hymns are "strophic" in nature (meaning that several verses are sung to a single melody), and are usually harmonized in Soprano, Alto, Tenor, and Bass parts.
Whether in popular Christmas music, Christmas hymns, or Christmas Carols, the purpose is to share the stories and traditions of Christmas in ways which can be enjoyed through passive listening and active participation of singing.