The Story in the Bible
But when Herod was dead, look, an angel of the Lord appeared in a dream to Joseph in Egypt, saying, "Arise and take the young child and his mother, and go into the land of Israel, for those who sought the young child's life are dead."
And he arose and took the young child and his mother, and went to the land of Israel. But when he heard that Archelaus was reigning over Judea in the place of his father, Herod, he was afraid to go there. Being warned in a dream, he withdrew into the region of Galilee, and came and lived in a city called Nazareth; that it might be fulfilled which was spoken through the prophets, that he will be called a Nazorean.
The History behind Joseph, Mary and Jesus returning from Egypt in the Christmas Story
Herod was very old and very ill at the time that ordered all the baby boys to be killed, sending the holy family into exile in Egypt. He was suffering from a very extreme case of delusional paranoia and killed anyone who posed even the slightest threat! He changed his will several times over the last few months of his life, as some of his sons were killed. He even ordered some of his sons to be killed, if he thought that were becoming too powerful!
Shortly before he died, Herod ordered all of Israel's rich and powerful people to be shut in the great hall of Jerusalem. He then gave orders to his sister to have all of the rich people killed after he died, so they could not become king after him!
Five days before Herod died, he killed the eldest of his remaining sons (who should have become king after him) and named his son Archelaus as the next King. When Herod died, he was buried in the Garden of Herodium near Bethlehem and Archelaus became King.
If you thought Herod was a bad King, Archelaus was far worse! That is why, when the holy family returned to Judea, they went back to their old town of Nazareth rather than returning to Bethlehem. Nazareth had a different ruler to Bethlehem because it was in the kingdom of Galilee not Judea.
Archelaus persecuted more people than Herod and spent all the people's tax money on things for himself rather than the kingdom. In the year 6 he was banished by the Romans to Gaul (a part of the Roman Empire that's now France) as a punishment!
Joseph, Mary and Jesus lived in Nazareth until Jesus started his teachings. This fulfilled another prophesy in the Old Testament of the Bible.