Geek and nerd had negative connotations when geeks and nerds were commonly poor, but then things shifted and, notably with the rise of the Information Age, being a geek and/or nerd turned into being useful in becoming wealthy. Now it is a compliment.
True of all insults, really. Same reason, for example, words with associations to slavery are considered insults. Or those related to the sale of sexual favours. The implication is that one is poor. Any words you can throw at someone who is rich will be something most people will want to wear as a badge of honour.
Fair, but it has also lost its connotations with being an insult over the decades.
Being a geek and/or nerd became economically useful when we moved into the information age, and thus is now considered in high regard. The average Joe is now envious of geeks and nerds. Most people would love to be able to trade places with Bill Gates or Elon Musk.
Of course, it wasn’t always that way.