Well, that question has been the topic of many theologians for centuries. Here is my personal take. I think it was because that when Jesus was on the cross, He was paying the price for all humanities sin. That is why God left Jesus on the cross and didn't take him down from there. Sin needed to be punished, and Jesus took the place of mine, yours, and the whole world's.