7 Then Herod, when he had secretly called the wise men, determined from them what time the star appeared.
8 And he sent them to Bethlehem and said, “Go and search carefully for the young Child, and when you have found Him, bring back word to me, that I may come and worship Him also.”
9 When they heard the king, they departed; and behold, the star which they had seen in the East went before them, till it came and stood over where the young Child was.
10 When they saw the star, they rejoiced with exceedingly great joy.
11 And when they had come into the house, they saw the young Child with Mary His mother, and fell down and worshiped Him. And when they had opened their treasures, they presented gifts to Him: gold, frankincense, and myrrh.
12 Then, being divinely warned in a dream that they should not return to Herod, they departed for their own country another way.
what time the star appeared (v.7) — Herod was attempting to determine when Jesus was born. The wise men must have reported that it was about two years previously based on Herod’s response in v.16.
stood (v.9) — the star was supernatural. The wise men saw it when they were in the east and again when they left Jerusalem. They did not follow it all the way from their own country.
gold (v.11) — probably the money Joseph used to travel to Egypt with his family
Unquestionably the gifts were chosen appropriately: gold for His deity and majesty, frankincense for the fragrance of His life and His intercession, myrrh for His sacrifice and death. — Walvoord, page 23
Several commentaries say this (above) about the gifts in almost the exact same words, but none bother giving any Scriptural basis for it.
The Lord was presented in the temple forty-one days after His birth (Luke 2:21 with Leviticus 12:3-4) , and thence returned to Nazareth (Luke 2:39). The events in this chapter, therefore, occurred later, i.e., between Luke 2:39 and Luke 2:40. — Williams, page 697
The question has been raised, Where did they find the child? In Luke we read, “And when they had performed all these things according to the law of the Lord, they returned unto Galilee, their own city Nazareth” (Luke 2:39). Now if the wise men came about a year later, did they find the child in Bethlehem or were they guided all the way up to Nazareth?
The Gospel of Luke gives the answer. “Now His parents went to Jerusalem every year at the feast of the Passover. And when He was twelve years old they went up to Jerusalem after the custom of the feast” (Luke 2:41-42). This brings out that they were a year after again in Jerusalem for the feast, and were therefore not in Nazareth. Bethlehem was truly their city, and the very short journey was made there from Jerusalem, where the wise men now found the young child with Mary His mother. — Gaebelein, pages 47-48.
In other words, they lived in Nazareth but traveled to Jerusalem every year for the Passover, probably staying with relatives in Bethlehem which was only five miles away.