There are two reasons why we die:
- We sin, and the “wages of sin is death” (Romans 6:23).
- We inherit mortality (Romans 5:17).
Since Jesus did not sin (Hebrews 4:15), only the second of these applied to him. That is, he inherited mortality because he was human.
However, because he did not sin, and lived a faithful and righteous life, it was not right for him to remain dead:
God raised him up, loosing the pangs of death, because it was not possible for him to be held by it. (Acts 2:24)