v1-2: Matthew omits many details of Christ's birth, leaving them to Luke. Instead he writes of Herod, the usurper, and of the Magi, respecting the true King of the Jews. But, either way, none can ignore Jesus Christ. Shepherds and wise men (Magi) worship Him; removing all human distinctions of class and culture.
The Magi came to worship Jesus Christ. This is a key theme in Matthew: in v11, they fell down and worshipped Him; in 8.2, a leper came and worshipped Him; in 9.18 a ruler (Jairus) came and worshipped Him; in 14.33, the disciples in the boat came and worshipped Him; in 15.25, the Canaanite woman came and worshipped Him; in 28.9, the women who went to the empty tomb held His feet and worshipped him; in 28.17, the disciples worshipped Him. Often this worship involved kneeling before Him; see 17.14; 20.20. Matthew is showing that, since Jesus is the Christ, He is fully deserving of the worship of mankind.
The Magi, astrologers, saw the child as unique, having His own star; here is God's grace, speaking to them in their 'language,' bringing them to Jesus. Their journey to Jerusalem is logical, since that was the capital of Judea, and they did not know the Bethlehem prophecy. They have seen the star as it rose (see margin), rather than in the east. The same phrase is used in v9. The word Magi (or sorcerer) is used of Simon (Acts 8.9) and Elymas (Acts 13.6-9). We might describe them as pagan diviners, seeking the future by reading signs. Had they had contact from Jewish scholars in their region (Psalm 72.10)? God spoke to these men bringing them to Judea to worship the Christ child.
v3: Herod, called a king, sees the child as a threat, and seeks to have Him killed.
v4: Herod seeks guidance from the religious leaders. See Jer 37.17, like Zedekiah, Herod is not really interested in what God has to say. His real interest is personal peace and convenience, and some justification of his actions.
v5: Bethlehem in Judah, where the Christ was to be born; contrast John 7.42,52.
v6: See also Ps 78.70-72; Jesus to be shepherd and ruler of Israel, as David had been before Him.
v7-8: Herod has no real desire to worship Christ. The references here are to a "child," and, with v16, where Herod has children under 2 years old killed, indicate that Christ was not a baby, but a young child. These events fit between Luke 2.38 and 39.
v9-11: On seeing the star they rejoice; on seeing the child, they worship. They bring gifts, Ps 72.10; Is 60.6. Again, we see that this is no ordinary child. It is the number of gifts that has made many think there must have been three Magi; some early writers put the number at 12. The reference in Ps 72, with the knowledge that Yemeni kings of the time professed the Jewish faith, indicates their likely origin.
v12: Although Herod asked the Magi to report back to him, v8, God spoke to them in a dream, and they obey God rather than men.
The culture of the Middle East recognises dreams as significant, and so God speaks to many in this way, from Abraham and Jacob in the OT, through to Joseph and the Magi here. In testimony today, we often hear of Middle Eastern converts having dreams.
v13-15: The Lord God speaks to Joseph the head of the family. He has the great responsibility to care for the Son of God. The journey into Egypt was no easy thing.
v16-18: Herod's cruelty; his original intention was to kill only the Christ, but developments changed his mind. It has been suggested that in his indiscriminate slaughter around 20-30 children where killed, but his character is that of a tyrant. It is said that Herod destroyed the genealogical records as well.
Matthew quotes the prophet, echoing Rachel's sorrow and Jeremiah's.
In a similar way, at the time of Moses' birth, Pharoah had murdered Jewish children (Ex 1-2). The parallels are striking. Moses became the delivered of the nation. Christ became the Saviour of the world.
Jews would also recall a slaughter at Ramah at the time of Nebuchadnezzar: see note at Jer 40.1.
www.biblenotes.org.uk/old-testament/Jeremiah/40/
v19-21: Joseph leads the family back to Judea. Herod, we learn, died a most painful and drawn-out death.
v22-23: It seems that the family has started back, when Joseph learns of Archelaus' reign, and diverts to Galilee. Joseph's plan was, until that point, to live in Bethlehem again, for he has family there.
An angel of the Lord appeared to Joseph in a dream. And this is repeated through chapters 1 and 2, as God, through His angel, steered Joseph and his family through a series of danger, to preserve His Son Jesus Christ. In the same way, in 1.1-17, God steered the history of the family of Abraham and the nation of Israel and later Judah, to preserve the 'royal line,' in which Christ would be born.