This joke is based on two uses of the word smell.
Smell can be used to describe something that has a bad or unpleasant odour:
"This fish smells! When did you buy it? (= This fish smells awful! When did you buy it?)
"I don't want to sit next to Dad - he smells!"
"What's that awful smell? Someone open a window!"
Smell is also the verb we use for inhaling an odour through the nose:
"Smell my new perfume. What do think about it?"
"Police dogs have a very good sense of smell. They are trained to smell drugs and explosives."