Derpy started out as a simple animation error, where there was one pony in the background whose eyes were looking different directions. A few people noticed this, and the animators apparently decided they should keep that a thing and call her Derpy.
Seriously, animation errors can go a long way to making a character famous.
I know five of the ponys in her "dress" carrot cutiemark:carrot top. berry and grape cutiemark:berry punch. music note cutiemarkctovia. lyra cutiemark: lyra heartstings. grey wings:derpy hooves... WHERE IS MY GUN?!