In Matthew 2:23 we read, "And he went and lived in a city called Nazareth, that what was spoken by the prophets might be fulfilled: 'He shall be called a Nazarene.'" Since there doesn't seem to be a passage in the OT that Matthew would be quoting, how can Matthew say that this fulfills what was spoken by the prophets?
One must use puns to see the fulfillment.
The wisdom of God is riddle  and the spirit of prophecy is the testimony of Jesus Christ. Matthew teaches the methods to read prophecy by giving us a series of riddles :
- He says there are 42 generations in the genealogy, when there are only 41.
- He says Yeshua (God's salvation) fulfills the prophecy he would be named Immanuel (God with us) Yeshua has a pun "Ya shuwa" meaning "God humbled".
- He teaches Drash by overlaying the stories of Moses, Abraham, Joseph and Israel concerning Egypt, then interpreting them Christologically.
Matthew uses the reference of the Nazarene because he fully expects we would understand, by way of pun, that the prophecy is that of the law of the Nazarite as a prophetic picture of Christ.
 Pr 1:6 To understand a proverb, and the interpretation; the words of the wise, and their dark sayings. [dark sayings = riddle]
As stated, there is nothing in the Old Testament that suggests it was spoken by prophets that Jesus would be called a Nazarene, so I look to Mark's Gospel for the answer. The strong consensus of modern New Testament scholars is that Matthew's Gospel was substantially based on Mark, which does refer to Jesus as a Nazarene.
In the original Greek, Mark refers to Jesus the Nazarene (Ναζαρηνοῦ) four times, at 1:24; 10:47; 14:67; 16:6 - although many Bibles translate this into English as 'Jesus of Nazareth'. Elsewhere, Mark 1:9 says Jesus came from Nazareth (ἀπὸ Ναζαρὲτ) to the place of baptism and on this basis Nazareth might well have been Jesus' home town, although some might have read this reference to Nazareth merely as the starting place of his journey. The author of Matthew knew that Mark several times referred to Jesus as the Nazarene.
Matthew’s Gospel mentions the town of Nazareth several times, but the first time Nazareth is mentioned (Matthew 2:23), the author felt the need to explain that the child Jesus was taken to Nazareth so that he shall be called a Nazarene. This suggests there was not yet a tradition that Jesus came from Nazareth, although there could have been an early tradition that Jesus was a Nazarene. The author assumed that Mark was well informed in calling Jesus a Nazarene, either from some prophetic source or even on the basis that the earlier evangelist should be considered a prophet in his own right. Either way, Matthew showed that what he thought of as said by the prophets had been fulfilled.
Are the prophets quoted in Matthew 2:23 Anna and Simeon of Jerusalem?
But when he heard that Archelaus was reigning over Judea in place of his father Herod, he was afraid to go there. After being warned in a dream, he went to the regions of Galilee. He came to a town called Nazareth and lived there. Then what had been spoken by the prophets was fulfilled, that Jesus would be called a Nazarene. Matthew 2:22-23 New English Translation (NET Bible)
So[cm] the child’s[cn] father[co] and mother were amazed[cp] at what was said about him. Then[cq] Simeon blessed them and said to his mother Mary, “Listen carefully:[cr] This child[cs] is destined to be the cause of the falling and rising[ct] of many in Israel and to be a sign that will be rejected.[cu] Indeed, as a result of him the thoughts[cv] of many hearts will be revealed[cw]—and a sword[cx] will pierce your own soul as well!”[cy] There was also a prophetess, Anna the daughter of Phanuel, of the tribe of Asher. She was very old,[cz] having been married to her husband for seven years until his death. She had lived as a widow since then for eighty-four years.[da] She never left the temple, worshiping with fasting and prayer night and day.[db] At that moment,[dc] she came up to them[dd] and began to give thanks to God and to speak[de] about the child[df] to all who were waiting for the redemption of Jerusalem.[dg] So[dh] when Joseph and Mary[di] had performed[dj] everything according to the law of the Lord, they returned to Galilee, to their own town[dk] of Nazareth. Luke 2:33-39 New English Translation (NET Bible)
The Triumphal Entry: And the crowds were saying, “This is the prophet Jesus, from Nazareth in Galilee.” Matthew 21:11 New English Translation (NET Bible)
All the people of Jerusalem, who were waiting for redemption, trusted that child, already born a prophet and resident in Nazareth, that is, Jesus the Nazarene.
It didn't. Both authors were "in the weeds".
The NT authors went through hoops to prove that Jesus fulfilled the scripture “He will be called a Nazarene” when that’s actually a misunderstanding on their part. The prophecy, originally about Samson, says that he will be a “Nazirite”, a member of a sect called the Nazirites, not a citizen of a town called Nazareth!:
[Num 6:13 NLT] (13) "This is the ritual law for Nazirites. At the conclusion of their time of separation as Nazirites, they must each go to the entrance of the Tabernacle
[Jdg 13:5 NLT] (5) You will become pregnant and give birth to a son, and his hair must never be cut. For he will be dedicated to God as a Nazirite from birth. He will begin to rescue Israel from the Philistines."
[1Sa 1:11 NLT] (11) And she made this vow: "O LORD of Heaven's Armies, if you will look upon my sorrow and answer my prayer and give me a son, then I will give him back to you. He will be yours for his entire lifetime, and as a sign that he has been dedicated to the LORD, his hair will never be cut."
[Amo 2:10-12 NLT] (10) It was I who rescued you from Egypt and led you through the desert for forty years, so you could possess the land of the Amorites. (11) I chose some of your sons to be prophets and others to be Nazirites. Can you deny this, my people of Israel?" asks the LORD. (12) "But you caused the Nazirites to sin by making them drink wine, and you commanded the prophets, 'Shut up!'
That’s why Samson had long hair!
So that makes two authors who were so ignorant of the Hebrew scriptures that they went to great lengths (multiple miracles) in their fictitious stories to have Jesus hail from two different towns, and neither contrived saga actually fulfills the original “prophecy” that they felt it was necessary to fulfill! Talk about bungling the job!
Have a very merry. - the Grinch!
In sensus plenior:
Nazarene and Nazarite are considered puns.
Heb 10.1 tells us that the law has a shadow of the good things coming. The law has a prophecy of Christ.
The Nazarite law is a prophecy of Christ. The Nazarite wears long hair which the flesh tells us is a shame on a man:
1Co 11:14 Doth not even nature itself teach you, that, if a man have long hair, it is a shame unto him?
This is a prophetic picture of Christ bearing our shame on the cross.
THe Nazarite did not drink wine or strong drink which represent grace and law, indicating that Jesus did not partake of grace or law since he was the source of grace and law.
The Nazarite did not touch dead bodies, and Jesus was buried in an unused tomb.
Jesus told us that he was about to fulfill the prophecy when, at the last supper, he said he would not drink again until...
We must not, however, mix pictures. He was not a Nazarite. He fulfilled the prophecy hidden in the law of the Nazarite. Since he was not a Nazarite, sipping a bit of vinegar on the cross does not violate the picture. To fulfill the prophecy, he bore our shame, did not partake of grace or law, and was untainted by sin in the grave though he carried ours there.
We can say with Matthew that he would be called a Nazarene.
When Nathaniel heard Jesus was from Nazareth, he asked if anything good could come from there, because Nazareth has the same root Nazir, meaning separate, but also meaning undressed. It is a shame to be undressed. Nathaniel knew how to use the puns.
The first answer also uses a pun which is acceptable in sensus plenior and would be a confirming set of linked verses, but puns are not permitted in the literal-historical method, though they are used occassionally with great discomfort.