Let's start by a description of the hadith!
The hadith is compiled in Sahih Muslim in the Chapter or Book of Repentance and under the heading "Sins are Erased By Praying For Forgiveness And Repenting". So imam an-Nawawi when (re-)arranging the Sahih of imam Muslim had in mind to emphasize that asking for forgiveness and repenting (sincerely) is a way to erase former sins. Also note that this hadith is the third and last one under this heading the other two ahadith were narrated on the authority of abu Ayub al-Ansari and reflect the same meaning or content.
This hadith actually also shows how big Allah's Mercy and Forgiveness actually is so that a true believer would and should never despair and have faith and think of Allah as an all forgiving Creator:
Say, "O My servants who have transgressed against themselves [by sinning], do not despair of the mercy of Allah . Indeed, Allah forgives all sins. Indeed, it is He who is the Forgiving, the Merciful." (39:53)
The qur'an also is full of examples of human sins and Allah's forgiveness.
There are ahadith which also shows how happy Allah is when his servant commits a sin and repents as quoted a few chapters earlier in Sahih Muslim:
Abu Huraira reported from Allah's Messenger (ﷺ) that his Lord, the Exalted and Glorious, thus said. A servant committed a sin and he said:
O Allah, forgive me my sins, and Allah (the Exalted and Glorious) said: My servant commited a sin and then he came to realise that he has a Lord Who forgives the sins and takes to account (the sinner) for the sin. He then again committed a sin and said: My Lord, forgive me my sin, and Allah, the Exalted and High, said: My servant committed a sin and then came to realise that he has a Lord Who would forgive his sin or would take (him) to account for the sin. He again committed a sin and said: My Lord, forgive me for my sin, and Allah (the Exalted and High) said: My servant sas committed a sin and then came to realise that he has a Lord Who forgives the sins or takes (him) to account for sin. O servant, do what you like. I have granted you forgiveness. 'Abd al-A'la said: I do not know whether he said thrice or four times to do" what you desire".
(See also in Sahih al-Bukhari)
Allah, the Exalted and Glorious, said: I live in the thought of My servant and I am with him as he remembers Me. (The Holy Prophet) further said: By Allah, Allah is more pleased wth the repentance of His servant than what one of you would do on finding the lost camel in the waterless desert. When he draws near Me by the span of his hand. I draw near him by the length of a cubit and when he draws near Me by the length of a cubit. I draw near him by the length of a fathom and when he draws near Me walking I draw close to him hurriedly.
(Sahih Muslim and Jami' at-Tirmidhi)
Allah is more pleased with the repentance of His servant when he turns penitently towards Him than one of you would be on finding the lost camel.
(Sahih Muslim and Jami' at-Tirmidhi)
Why would Allah be happy or pleased if we commit sins? pleased in this case means satisfied as this servant has understood that he has a Creator who is all forgiving and Merciful after committing a sin. So he repaired his wrongdoing by repenting. That's essential as either you may do a wrongdoing and go on forth sinning or you may commit a sin and repent, because you know that there's your Creator who is all Seeing all Hearing. Therefore only believers would come to reason and repent!
One could ask what would happen if we don't commit sins? The worst thing that could happen is that we might get filed with pride and self-importance as Allah has shown us by the example of Iblis who rejected to obey Allahs orders when he was asked to prostrate!
So the hadith in no way means that you may commit sin after sin endlessly (without repentance), it means:
- you may commit a sin,
- as long as you remind Allah and ask for forgiveness
- you might get pardoned by Allah.
So you must take the statement as a whole not partly!
If we went forth committing sins that means we are disbelieving as sinning is doing haram things or going against Allah's orders/prohibitions and Allah told us what he does with such people:
And your Lord is the Free of need, the possessor of mercy. If He wills, he can do away with you and give succession after you to whomever He wills, just as He produced you from the descendants of another people.
(6:133 I recommend you to start reading from 6:130 on)
Have you not seen that Allah created the heavens and the earth in truth? If He wills, He can do away with you and produce a new creation. (14:19)
And how many a city which was unjust have We shattered and produced after it another people. (21:11)
Note that these verses come in a context of kufr (disbelief).
Here one of my few sources -in Arabic- that provide an interpretation of the hadith. Imam an-Nawawi actually only refers to earlier interpretations in his commentary on Sahih Muslim which hardly address the whole topic of this hadith.