He did not say this on his own. But he was high priest at that time. So he told ahead of time that Jesus would die for the Jewish nation.