All perfect praise be to Allaah, the Lord of the worlds. I testify that there is none worthy of worship except Allaah and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
Smell is not something material to say that it is pure or impure. Consequently, you are blameless for this offensive smell. However, you should cleanse yourself properly for Islam urges purification. It is narrated that the Prophet, sallallaahu ‘alayhi wa sallam, said: "Each Muslim is required to have a bath (at least) once every seven days where he washes his head and body." [Al-Bukhari and Muslim. This is the wording of Al-Bukhari]
One should also intensively use perfume in compliance with the methodology of the Prophet, sallallaahu ‘alayhi wa sallam, who loved it and encouraged Muslims to use it. It has been narrated that he said: "Endeared to me of this worldly life is (marrying) women and (applying) perfume, and prayer has been made the apple of my eye." [Ahmad and An-Nasaa’i; Al-Albani: good-authentic]
It was also narrated that he said: "When one is offered perfume, he should not reject it, for it has a nice scent and it is easy to carry." [Abu Daawood, An-Nasaa’i and Ahmad; Al-Albani: authentic]
Allaah Knows best.