Jesus was punished on the cross for things He did not do; so that we would not be punished for things we have clearly done.
Our sin was imputed to Him, though He is perfect, spotless, undefiled, separate from sinners, holy, and without sin; but by grace through faith in Jesus Christ, His perfect righteousness is imputed to us though we are completely depraved, disobedient, children of wrath by nature, sons of disobedience, slaves of sin, sinful and sinners from the moment of our conception. All our righteousness is dirty, filthy rags; all His righteousness is the perfection of His holiness.
Jesus Christ lived a sinless life in perfect conformity to God's Law--He fulfilled it; He offered the perfect sacrifice, Himself, as the spotless Lamb of God to satisfy God's justice, holiness, and divine wrath; and He was the great High Priest who once for all went beyond the veil as the Captain of Salvation... our Federal Head in the covenant of grace.
Jesus Christ alone satisfied God, so that we through Christ could be justified by God. There is no other name, given among men, under heaven, whereby we must be saved.
(Psalm 32:1-5; Hebrews 2:9-18; Romans 3:21-26; Philippians 3:1-11; 2 Corinthians 5:18-21)