He then began to teach them that the Son of Man must suffer many things and be rejected by the elders, the chief priests and the teachers of the law, and that he must be killed and after three days rise again.
Mark 8:31 NIV
God did not have to create the universe. Nor did he have to offer a means of salvation to fallen humanity. But he did create us. And he did choose to redeem us. It is in that context that Jesus told his disciples that he must suffer and be rejected. And that he must be killed and rise on the third day. Not that he would be rejected and killed. But that he must be rejected and killed.
In God’s plan for our redemption, it was necessary that Jesus go to the cross, suffer, and die. And that after three days in the grave, he would rise. The rejection, death, and resurrection of Jesus are essential to our salvation.
There is so much I do not understand about Jesus’ atoning death on the cross. But the Scripture is clear that in Jesus’ death on the cross, he made atonement for my sins. He took my place, paying the penalty that was mine. And in his resurrection, he defeated death, enabling me to experience eternal life.
Two answers can be given to the title question: did Jesus have to die on the cross? On the one hand, we can say he did not. God could have left us where we were, alienated from him and doomed to destruction. But, on the other hand, because God chose to redeem us, he did have to go to the cross. And because he did, I can experience his salvation.