Where does the story of the Magi come from?

The modern interpretation of chapter two of the Gospel of Matthew, which is the only part in which the story of the Magi comes out, considers this episode as a theological story. In ancient times, when someone wanted to express a theological idea, they would make up a story and put it under the cover of a famous person from Jewish antiquity. Matthew applies the story of the Magi to show that the Messiah is a universal Messiah. Matthew uses The Book of Numbers and the story of Moses to narrate this episode.