Why did Mary take Jesus to Egypt?
King Herod was looking for them so he could murder Jesus. Herod had been told that Jesus was born King of the Jews; and since Herod was the King he believed that Jesus would depose him if he let him live.
In Matthew's Gospel, Joseph fled to Egypt with Jesus and Mary, and remained there until Herod died. However, in Luke's Gospel, Joseph, Jesus and Mary did not go the Egypt. They travelled to Herod's capital, Jerusalem, shortly after the birth then returned peacefully to Nazareth in Galilee. For Luke, Herod had no interest in the baby Jesus.