That's been a part of what "nerd" means ever since people started using that word. A lot of people want to claim the actual origin now that it's a cool word, but all the claims agree (ironically?) it was about calling somebody uncool. Everyone seems to agree that wherever it came from, Happy Days popularized it, with episodes like this one where a She-Devil brings in a nerd for everyone to laugh at (Spoiler: It is Fonzie in disguise).
But now a lot of the people who get labeled "nerds" are hardly social rejects. Movies glorify hackers as cool rebels. The lives of computer moguls like Steve Jobs and the Google guys are actually envied by people. When they give a movie hero 10 unbelievable high-prestige jobs at once to show how cool they are, one of those jobs is often "brilliant scientist," as in "Vin Diesel plays a brilliant scientist who is also a daredevil stuntman and the President of the United States."
"Denise Richards plays a brilliant scientist who is also a stand for attaching large breasts."