Why did Jesus have to die? From what I can tell, He wasn't guilty of doing anything wrong, and I've always looked on Jesus' execution as a great injustice.
Yes, from one point of view, Jesus’ death was a great injustice. Not only was He innocent of any crime, but as God’s only Son He was without sin of any kind. “Can any of you prove me guilty of sin?” Jesus asked His opponents and they had no answer (John 8:46).
But from another point of view, the Bible says Jesus was guilty and the reason is because all our sins were transferred to Him. Yes, He was innocent and without sin but He willingly allowed all our sins to be poured on Him. He did not deserve to die but by taking upon Himself our sin and our guilt, He willingly suffered the judgment we deserve. He died in our place.
Think of it this way. Suppose one day you were caught speeding, and were brought before the judge. You knew you were guilty and deserved the fine he imposed but then you discovered you didn’t have the money to pay it. Then suppose the judge stepped down from his bench, opened his wallet, and paid the fine for you. You would be free!
This is what God has done for us. We are guilty and deserve God’s judgment, but God sent His Son into the world to take that judgment upon Himself. He paid the price for our salvation by dying on the cross for us. Now He offers us forgiveness and salvation as a free gift, free because He has already paid for it. Have you accepted that gift by committing your life to Christ?