John 3:16 states "For God loved the world so much that he gave his only-begotten Son, so that everyone exercising faith in him might not be destroyed but have everlasting life". Thus, it was not God that died, but rather his own son whom he sent to die for our sins.
As to why God had his son Jesus sacrificed for our sins, 1 corinthians 15:22 states "For since death came through a man, resurrection of the dead also comes through a man. For just as in Adam all are dying, so also in the Christ all will be made alive". Since Adam who was a perfect human sinned and brought sin onto mankind, it would require the sacrifice of another perfect human life, Jesus, to counteract and elimanate sin.