What Judaism teaches
The prophet Malachi prophesied that Elijah, who did not die but was taken up by God, would have to come a second time before the Messiah comes.
Malachi 3:1 Behold I send My angel (the word also means “messenger”), and he will clear a way before Me. And suddenly, the Lord Whom you seek will come to His Temple. And behold! The angel of the covenant, whom you desire, is coming, says the Lord of Hosts.
Malachi 3:23-24 Lo, I will send you Elijah the prophet before the coming of the great and awesome day of the Lord, that he may turn the heart of the fathers back through the children, and the heart of the children back through their fathers-lest I come and smite the earth with utter destruction. (Found in Malachi 4:5-6 in the Christian Bible)
Since Elijah has not come yet, Jesus could not be the Messiah.
John the Baptist, a foreshadow of Elijah, came before the first coming of Jesus and the real Elijah will come before the second coming of Jesus.
John the Baptist was the person who foreshadowed the coming of Jesus. However, John the Baptist denied that he was Elijah.
John 1:21 They asked him, “Then who are you? Are you Elijah?” He said, “I am not.”
Jesus taught that John the Baptist was a type of (or foreshadow of) Elijah, who has already come. However, the actual Elijah has not yet come.
Matthew 17:10-12 The disciples asked him, “Why then do the teachers of the law say that Elijah must come first?” Jesus replied, “To be sure, Elijah comes and will (future tense) restore all things. But I tell you, Elijah has already (past tense) come, and they did not recognize him, but have done to him everything they wished. In the same way the Son of Man is going to suffer at their hands.” Then the disciples understood that he was talking to them about John the Baptist.
When the angel announced the birth of John the Baptist, he said that John the Baptist will go “in the spirit and power of Elijah.”
Luke 1: 11-13, 17 Then an angel of the Lord appeared to him, standing at the right side of the altar of incense. When Zechariah saw him, he was startled and was gripped with fear. But the angel said to him: “Do not be afraid, Zechariah; your prayer has been heard. Your wife Elizabeth will bear you a son, and you are to call him John… And he will go on before the Lord, in the spirit and power of Elijah, to turn the hearts of the parents to their children and the disobedient to the wisdom of the righteous—to make ready a people prepared for the Lord.”