New York Magazine attributes the creation of "derp" to a scene from the 1998 comedy "BASEketball," an absolute banger of a dumb, dumb film that Matt Stone once described as "the stupidest movie ever made" and which the duo famously only agreed to make when they thought that "South Park" was going to be canceled. "BASEketball" enjoys a largely improvised comedic style, so when Stone's character, Doug Remer, is caught in the act of doing unspeakable things to his crush's mom's unspeakable things, his exclamation of "Derp!" feels roughly organic.
Little could Stone have guessed that, with a single syllable, he had given birth to a cultural touchstone. The introduction of the word "derp" to the linguistic zeitgeist would see support the following year when Trey Parker and Stone debuted the character Mister Derp to the "South Park" family of weirdos. A substitute in the cafeteria while Chef was getting married, Mister Derp had a habit of hitting himself in the head with a hammer and proclaiming his own name like some sort of self-hating Pokemon.
Long story short: "South Park" didn't create "derp," but the creators of "South Park" did, and then "South Park" stoked the "derp" flames until they became a raging fire. Derp.