The priestly class of Persia and Media were called magi. People of the ancient world considered them as scholars of the supernatural and astrologers able to interpret dreams, omens, and signs in the heavens. The Prophet Daniel vied with them in Babylon and Persia, and Nebuchadnezzar appointed Daniel as “chief of the magicians, conjurers, Chaldeans and diviners” (Daniel 5:11). By the days of the Master, the Jewish community applied the word “magi” broadly to astrologers, diviners, and magicians. (Singular form is "magus".) Somewhere in the east, perhaps in Parthia, Arabia, or, most likely, in Babylon, certain astrologers saw a new star rise in the sky.
The magi were not rabbis, nor were they Jewish. The New Testament never refers to sages or rabbis as magi. Jewish scholars took an interest in astrology, but they generally considered the people of Israel immune from the influences of the stars and planets. Though the stars and constellations might hold predictions for the Gentiles, the Jewish people were not supposed to be concerned with such predictions:
How do we know that the people of Israel are not under the influence of the stars? Because it is said, “Do not learn the way of the nations, and do not be terrified by the signs of the heavens although the nations are terrified by them” (Jeremiah 10:2). The nations are terrified, but not Israel. (Talmud)
Nevertheless, Judaism does associate Messiah with the sign of a star. The star of Messiah alludes to Balaam’s prophecy in the book of Numbers. Balaam himself was a magus from the East. Long ago, in the days of Moses, the Gentile prophet Balaam beheld the messianic advent and said, “I see him, but not now; I behold him, but not near; a star shall come forth from Jacob, a scepter shall rise from Israel” (Numbers 24:17). The sages understand Balaam’s prophecy to apply to the house of David and Messiah. In the early second century, Rabbi Akiva declared Shim’on bar Kosiva to be the messiah; he renamed the rebel warrior Bar Kochba, “Son of the Star,” using Numbers 24:17 as his proof text.
Why were Gentile astrologers interested in a star indicating the birth of a Jewish king? Perhaps their sacred tradition remembered the days when Daniel sat as chief of the magi of Babylon and Persia. If they did not receive the tradition from Daniel, perhaps the sizable Jewish Diaspora living in Babylon passed on the Jewish belief in the coming of the Messiah.
The magi sent a delegation to Jerusalem to seek out the infant king. Church iconography ordinarily depicts three magi traveling to Jerusalem, one for each gift, but Matthew does not give a number. They did not follow a star to Jerusalem. Instead, they saw a star rise that indicated the birth of a Jewish king. Sometime later, they traveled to Jerusalem, the royal city of the Jews, expecting to find the child in the palace of the king. They received directions to Bethlehem, and when they arrived there, they again saw the star over the place.