Popular theory has it that this little gem of a word was coined by Theodor Geisel, aka Dr Seuss, in his 1950 book If I Ran the Zoo. That may be a stretch, however. While Dr Seuss almost certainly played a key role - if not the key role - in popularising nerd, the word had been around for a few years already as a variation on nert, which itself was a humorous pronunciation of nut.
In If I Ran the Zoo, nerds are what the Oxford Words blog describes as "small, unkempt, humanoid creature[s] with a large head and a comically disapproving expression". Some would argue that the word's meaning hasn't altered since, but try telling that to Bill Gates or Mark Zuckerberg during the job interview.
Related insulty type words include geek and the rather aggressive nimrod. Geek originally meant a sideshow freak (hence Bob Dylan's lyric "you hand in your ticket / to go see the geek"), which possibly derived from the German geck, to mock or cheat. The modern sense of a social misfit with advanced computer skills dates from the early 1980s. Like nerd, geek has been reclaimed by those who've been labelled with the term, which makes it a kissing cousin of words like gay, dyke, queer and even some racially abusive terms which I won't repeat here.
Nimrod, on the other hand, was the son of Cush, referred to in Genesis as "a mighty hunter before the Lord". How the name became an insult is a mystery, although various theories have been suggested - none of them convincing. Whatever the case, one thing you can be sure of is that if anyone calls you a nimrod today, they're not expressing their admiration for your impressive pedigree.