Smelly is an alter ego of Squidward Tentacles."It" appeared in The Thing.
Smelly originated when Squidward fell off his bike and got stuck in the cement. This made him look like an animal, hence why Spongebob and Patrick had no idea that he was indeed Squidward.
SpongeBob and Patrick "rescued" him and Patrick took him in to live with him. Eventually the police capture Smelly and put him in the Bikini Bottom Zoo. They call him "Unknown Species" only to be rescued again by SpongeBob and Patrick. At the end of the episode Smelly is freed to roam with his own kind. When he gets there his identity is revealed and the episode ends. It is reavealed that Smelly is smelly. Apperantley, he is enemies with Gary and Gary is, apparently, the only one who knows who he is.