The first known instance of the word “derp” comes from the 1998 comedy film Baseketball by South Park creators Trey Parker and Matt Stone. During a scene where they are caught smelling underwear taken from a woman’s private drawer, Matt runs out of the room and says “Derp.”
Know Your Meme credits the movie Baseketball.
I honestly predicted that “derp” would be taken up in slang when that show came out For one of the few times in my life, I was right.