It is said by critics that a man came to the Prophet and confessed to have committed adultery:
Narrated Abu Hurayrah: A man of the tribe of Aslam came to the Prophet (p) and testified four times against himself that he had had illicit intercourse with a woman, while all the time the Prophet (p) was turning away from him. Then when he confessed a fifth time, he turned round and asked:
Did you have intercourse with her? He replied: Yes. He asked: Have you done it so that your sexual organ penetrated hers? He replied: Yes. He asked: Have you done it like a collyrium stick when enclosed in its case and a rope in a well? He replied: Yes. He asked: Do you know what fornication is?
He replied: Yes. I have done with her unlawfully what a man may lawfully do with his wife. He then asked: What do you want from what you have said?
He said: I want you to purify me. So he gave orders regarding him and he was stoned to death. Then the Prophet (p) heard one of his companions saying to another: Look at this man whose fault was concealed by Allah but who would not leave the matter alone, so that he was stoned like a dog.
He said nothing to them but walked on for a time till he came to the corpse of an ass with its legs in the air. He asked: Where are so and so?
They said: Here we are, Apostle of Allah (p)! He said: Go down and eat some of this ass’s corpse. They replied: Apostle of Allah! Who can eat any of this? He said: The dishonour you have just shown to your brother is more serious than eating some of it. By Him in Whose hand my soul is, he is now among the rivers of Paradise and plunging into them. – (Abu Dawud Book 39, Number 4414)
This Hadith is declared weak by Islamic Scholar Shaykh Albani. Therefore it cannot be used as evidence against the Prophet (p). Furthermore, the story above shows that the person was adamant to get punished for what he did. However, the same story is in one authentic Hadith book of Imam Malik’s Muwatta. It states that he was not killed but only whipped for committing adultery:
Malik related to me from Zayd ibn Aslam that a man confessed to fornication in the time of the Messenger of Allah, may Allah bless him and grant him peace. The Messenger of Allah, may Allah bless him and grant him peace, called for a whip, and he was brought a broken whip. He said, “Above this,” and he was brought a new whip whose knots had not been cut yet.
He said, “Below this,” and he was brought a whip which had been used and made flexible. The Messenger of Allah, may Allah bless him and grant him peace, gave the order and he was flogged. Then he said, “People! The time has come for you to observe the limits of Allah.
Whoever has had any of these ugly things befall him should cover them up with the veil of Allah. Whoever reveals to us his wrong action, we perform what is in the Book of Allah against him.” – (Muwatta Malik Book 41, Hadith 12)
Conclusion; Sexual intercourse before marriage is a major sin. Hence, the man wanted to be cleansed from his sin in this life so to not get punished in the hereafter. Hence, he persisted in asking the Prophet (p) to get punished. Reading the story, the Prophet (p) ignored him many times, but the man didn’t give up until he was punished, so he was lashed for it.