According to the Catholic Encyclopedia, Advent began sometime after the 4th century as a time of preparation for Epiphany, and not in anticipation of Christmas. Epiphany celebrates the manifestation of Christ by remembering the visit of the wise men and, in some traditions, the Baptism of Jesus. At this time new Christians were baptised and received into the faith, and so the early church instituted a 40-day period of fasting and repentance.
Later, in the 6th century, St. Gregory the Great was the first to associate this season of Advent with the coming of Christ. Originally it was not the coming of the Christ-child that was anticipated, but the Second Coming of Christ.
By the Middle Ages, the church had extended the celebration of Advent to include the coming of Christ through his birth in Bethlehem, his future coming at the end of time, and his presence among us through the promised Holy Spirit. Modern-day Advent services include symbolic customs related to all three of these “advents” of Christ.