The Phrase Finder writes that etymologists are at odds about where this phrase actually originated from. They write that there are two options:
The phrase originated as 'son of a military man' (i.e. a gun). The most commonly repeated version in this strand is that the British Navy used to allow women to live on naval ships. Any child born on board who had uncertain paternity would be listed in the ship's log as 'son of a gun'. While it is attestable fact that, although the Royal navy had rules against it, they did turn a blind eye to women (wives or prostitutes) joining sailors on voyages, so this version has plausibility on its side.
The term is euphemistic and derived as a conveniently rhyming alternative to 'son of a bitch/whore'. That term has been part of the language for centuries, certainly long enough for people to some up with a euphemism for it. Shakespeare used something like it in King Lear, 1605 - "One that art nothing but the composition of a Knave, Begger, Coward, Pandar, and the Sonne and Heire of a Mungrill Bitch."
There are sourced examples which support either of these hypotheses. For example, there is 19th century literature supporting the second option as well as 19th century examples supporting the first. Both options, however, lead to the conclusion that the phrase is a euphemism for son of a bitch.
According to the Oxford English Dictionary, the nature of the beast first appeared in the 1600s:
colloq. the nature of the beast : the (usually undesirable) inherent or essential quality or character of a person, event, circumstance, etc.
1678 J. Ray Coll. Eng. Prov. (ed. 2) 77 It's the nature o' th' beast.
John Ray's Collection of English Proverbs was a collection of proverbs from different languages, as well as a list of words, a fact noted by the title page shown here. However, it seems very possible that the phrase predates this notation. The phrase appears in a dictionary entry for nature, and the nature of the beast was used to give an example sentence.
It is possible that the phrase was well known enough that, by the time Ray compiled his list, it was an accepted idiom. However, his work is the first written usage, so we can definitely note the point at which the idiom existed. Because this is the first written usage, however, we cannot derive its origins--the phrase was written, but its precise origins were not.
That being said, the OED marks usage of beast which are related, and possibly point to the history of the phrase. In the entry of beast, two definitions are:
In early times, explicitly including man. Obs.
In later times, applied to the lower animals, as distinct from man. (First usage noted is in 1616)
The animal nature (in man). (first usage noted 1667)
The phrase the nature of the beast, having been recorded in 1678, may have been pulling on the first noted definition. That is, the nature of the beast was the inherent nature of man; that deepest essence within him. The later definitions may also work (as a beast is lower than man, "the nature of the beast" is the lower qualities within a man). The old usage of the term beast would explain the origins of the phrase--it was a normal definition of beast, which literally described the inner nature of man.
Best Answer
Fanboi pre-dates both Avril Lavigne's "Sk8er Boi" song (2002) and Apple's iDevices (iMac, 1998), however usage increased dramatically since the 2007 release of the iPhone, and it is now often used a a put-down when talking about zealous Apple fans.
Usenet
The excellent Technologizer post says "fanboy" originates from the comic collector world, and the earliest references to "fanboi" I can find in Usenet are also from comics groups.
In a 9th October 1996 post to rec.arts.comics.misc, The Comics Journal wrote:
Two days later, PatDOneill replies, showing from the start the term has a somewhat negative flavour:
Ray Mescallado's signature in a 22nd November 1996 rec.arts.comics.dc.lsh post was:
The post was asking the Legion of Super-Heroes "fandom" their opinions of the comic for the Comics and Animation Newswire. He wrote a lot about "fanbois".
Urban Dictionary
The earliest Urban Dictionary definitions aren't until 2003, but both clearly have negative meanings:
iPhone fanbois
More recently, both fanboy and fanboi are used to describe zealous fans of technology and products, in addition to comics, games and films. The use of fanboi is especially used to describe ardent fans of Apple products, and in particular appears to have increased dramatically around the 9th January 2007 announcement and 29th June 2007 release of the iPhone.
The Register is an IT news site particularly fond of iconoclastic slang. A quick tally of their 116 articles including the word fanboi show 111 are in the context of Apple/iPhone/iPad/iMac/Mac/MacBook. (The others are Java (x2), Rackspace, AWS, and e-voting.) The earliest was published in an article titled "iPhones, iPhones and more iPhones" on 13th July 2007, and is a round up of comments following the recent US release:
Google's Insights for Search backs this trend up. The main peak begins in November 2006, soon before the iPhone's official January 2007 announcement, as hype around Apple's rumoured iPod-mobile phone was "reaching fever-pitch".