He did not say this on his own. As the high priest that year, he was prophesying that Jesus was going to die for the nation —
In context
49But one of them, Caiaphas, who was the high priest that year, said to them, “You understand nothing. 50You do not even see that it is better for you that one man die for the people than that the whole nation perish.” 51He did not say this on his own. As the high priest that year, he was prophesying that Jesus was going to die for the nation — 52and not for the nation only, but also to gather into one the scattered children of God. 53From that day on, they were resolved to kill him.