The magi were men who studied the stars, poured over ancient manuscripts, and interpreted dreams. They were seers who were influential figures in their own cultures. While they were not kings (popular misconception, and there might have been more than three), they served kings. It's not inappropriate, however, to refer to them as wise men, as they represented the wisdom of their people. Additionally, they were Gentiles, non-Jews. These two facts are important for us to appreciate.
In his telling of the events it appears that Matthew wants his readers to understand the presence of the magi as signaling primarily two things. The first is the superiority and truthfulness of God’s wisdom to any other supposed wisdom. These men had come to some conclusions as a result of their research. Their likely familiarity with Hebrew writings, such as Psalm 72, led them to look for the coming of the one who would usher in a reign of universal peace and prosperity. And when they saw the star rise that heralded his birth they sought him out to pay him homage (wise men, indeed!). When they bow before him, it's as if they are laying down all of the world's wisdom at his feet. The second is the long-prophesied inclusion of Gentiles among those who benefit from the coming of the Messiah. From the very beginning, the coming of the promised one was “good news of a great joy . . . for all the people.” Salvation is not just for the Jews but for all who place their hopes in the one who was born of the virgin.
Is it any wonder that when the magi entered the house “they fell down and worshiped him” and “offered him gifts”? Whether they were fully cognizant of what the coming of this child meant, their actions were appropriate. He was the King of Kings, the Savior of the World.