He deserved to die. He said so himself. He received the harshest penalty available under the law, yet he claimed publicly that his punishment was just.
At the last moment, he met Jesus. He confessed his own guilt and its due reward. He acknowledged Jesus as Lord and asked for mercy. To the day he died, He never went to church, he never did anything for God or for anyone else, but his request was granted. We can surely approach God with the same confidence!
“Then one of the criminals who were hanged blasphemed Him, saying, “If You are the Christ, save Yourself and us.” But the other, answering, rebuked him, saying, “Do you not even fear God, seeing you are under the same condemnation? “And we indeed justly, for we receive the due reward of our deeds; but this Man has done nothing wrong.” Then he said to Jesus, “Lord, remember me when You come into Your kingdom.” And Jesus said to him, “Assuredly, I say to you, today you will be with Me in Paradise.”” (Luke 23)