 Cayafas didnt think up those words by himself. He told them, Jesus has to die instead of the people, but those were really Gods words that he said. You see, he was the big boss of the Jewish ceremonies at that time, so God used him to say that Jesus was going to die for the Jewish nation. 