He was the mercenary who was hired by Sheldon J. Plankton to kill SpongeBob SquarePants and Patrick Star. The reason being that Plankton stole King Neptune's crown and tricked Neptune into believing the crime was committed by Eugene H. Krabs, so Neptune threatened to execute Krabs (via burning by fire) unless the crown was retrieved within a period of six days; Plankton, obviously, wanted Krabs to die from a painful and wrongful execution, and upon learning SpongeBob and Patrick's journey to get the crown back, he sends Dennis after them.
SpongeBob and Patrick encounter Dennis for the first time after reaching the end of the Deep Dark Trench. Dennis was about to kill them with his "big" spiky boot, only to be stepped on by the Cyclops' (a scuba diver) "bigger boot". In the climax of the film, SpongeBob and Patrick hitch a ride on the backside of David Hasselhoff, who speedily swims through the ocean in order to send them back to Bikini Bottom. During the middle of their swim, SpongeBob and Patrick see the boot belonging to the same diver who squished Dennis. Dennis then detaches from the boot and onto Hasselhoff, revealing that he is still alive. He tries to kill SpongeBob and Patrick, but fails yet again. He gets knocked off by a boat Hasselhoff swam, never to be seen again by the viewers. It is unknown what became of him after this, but it was most likely he just fell into the water or he could've died.
Dennis appeared twice and was defeated by pure luck both times. (First he was stepped on by the cyclops then he was hit by a boat)
Spongebob and Patrick were most likely the first people to successfully escape Dennis due to the fact that he quickly went insane after being defeated only once.