If Matthew's magi actually existed, they would have been members of the Zoroastrian religion. Magi were priests of the then-great Zoroastrian religion of Persia, so it would have suited the author of Matthew's Gospel to portray them as wishing to worship the founder of a rival religion.