I've heard it was to welcome the Christ child, but I believe it had its start in offering a welcoming light to greet family members and expected visitors to the home. Here are some cultural reasons I've found.
Friendship
In many cultures a candle in the window symbolizes friendship to travelers.
In Colonial Times
A candle in the window in colonial times was to welcome home a family member who was traveling. Candles were also used during celebrations to show respect for public figures.
In Ireland
During times of persecution Catholics placed a candle in the window of their home to signified that their home was a safe location for priests to visit. Three candles placed together in the window symbolized the Holy Family.
Judaism
During Hanukkah it is a common practice for Jews to place a Menorah in the window of their home. The Menorah a nine-branched candelabrum. It is lit during the eight-days of Hanukkah to symbolize the miracle of the oil that burned in the Temple for eight nights.
Christianity
On Christmas Eve, it is a common practice for Christians to place a large candle in the window of their home. The candle symbolizes the star of Bethlehem which led the three Wise Men to the birth place of Jesus Christ. When the candle is lit it also symbolizes Jesus as the "Light of the World".