Why did the Son of God have to die?
The answer to why Jesus had to die, lies in the fact that a just and perfect God could not simply sweep the considerable and ongoing wrongdoing of His creation under the carpet and then continue as if there was nothing wrong. In His perfection it was not and is not possible for Him to do that and so God had to deal with the terrible sins of His creation in another way.
Sin is the falling short of the perfection to be found in God's world and the corollary to that is the terrible sins of mankind are deserving of the destruction of their perpetrators. If God was to save mankind by paying the price of humanity's falling short on their behalf then that price could be nothing less than the death of God and this He chose to do.
However, God as God could not and cannot die, and so in order that He might pay that price He really had no choice but to take on human form in the person of the man Jesus. So God became man and assumed the consequence of sin on behalf of mankind and the consequence of that was His death.
Rather than God having to inflict destruction upon a sinning mankind, He Himself paid the price for their transgressions and what a price. Unjustly condemned, rejected by His followers, spat upon, cruelly flogged, made to carry the means of His death and finally crucified, that worst of all possible deaths, He gave up His life for a wholly sinful world who He forgave as He breathed His last.
God's death in Jesus bridges the yawning gap that exists between God and His creation and reconnects sinful humanity back to God and then with His subsequent resurrection He defeated death and opened the gates of Paradise to all who believe in Him.
God in Christ bears the pain and agony of death by crucifixion to bring us mercy and forgiveness and He suffers for us that which He does not have to suffer. In simple terms He came to pay a debt He did not owe because we owed a debt we could not pay and in so doing God became man that man might become God.
To bring both about He died that we might live, and this gives just an inkling of the boundless love He has for His creation.