Word for the person who willingly take the punishment of someone else

Solution 1:

Jesus chose to be a scapegoat. Originally this was a goat that bore the sins of a community, but its transferred sense is anyone who bears the blame for others. Merriam-Webster:

1 : a goat upon whose head are symbolically placed the sins of the people after which he is sent into the wilderness in the biblical ceremony for Yom Kippur

2a : one that bears the blame for others

b : one that is the object of irrational hostility

The fact that scapegoating is often involuntary should show the altruistic qualities of anyone who becomes a scapegoat voluntarily. Furthermore, a cursory Google search shows that comparisons between Jesus and the scapegoat are nothing new.

Solution 2:

Scapegoat is the word I would use. The history of the word from ancient Hebrew traditions fits well with the role Jesus took on.

Defined here as

a person or group made to bear the blame for others or to suffer in their place.

Solution 3:

'Scapegoat' is a good word for this. 'Substitute' and 'ransom' are also frequently used.