Nerd - 1. a stupid, irritating, ineffectual, or unattractive person.
2. an intelligent but single-minded person obsessed with a nonsocial hobby or pursuit: a computer nerd.
I'm sure the second definition was added after the younger generations started getting less intelligent and they needed smaller words to talk about others because they weren't smart enough to come up with a good insult.
I have to say that I wholly agree with both definitions.
I think a nerd is someone who's interested in academic pursuits. That's why scientist etc. are often considered nerds.
The second definition in my book is really more of a geek. You don't have to be intelligent to be a geek.