Geek is one of those words which has been shapeshifting through time.
While this word probably came from the German word geck, which meant a fool, dupe or a simpleton.
The word was used in English in America in the 1900s to describe a ‘sideshow freak’ in a circus. They were usually engaged in grotesque acts such as biting the heads of small animals, such as chickens.
In June 1935, The American Mercury published an article titled The Mystery of the Carnival Language, in which Geek referred to a degenerate who bites off the heads of chickens in a gory cannibal show.
By the late 1950s, it came to be used in the context of an overly diligent, unsociable person. This was most likely an accident. By the 1980s, the word came to be used to describe an unsociable person with an obsessive interest. Most likely in computers.
By the 21st century, the word had lost its negative connotation and started being viewed in a positive light.