how did the epithet "nigger" come into usage?
Niger is Latin for 'black'. That's the source of all the trouble. Nigger itself (with the Latin spelling) is recorded in the Oxford English Dictionary as being first used in 1574 'by whites or other non-blacks as a relatively neutral (or occasionally positive) term, with no specifically hostile intent'.
According to Etymonline.com:
nigger 1786, earlier neger (1568, Scottish and northern England dialect), from Fr. nègre, from Sp. negro (see Negro). From the earliest usage it was "the term that carries with it all the obloquy and contempt and rejection which whites have inflicted on blacks" [cited in Gowers, 1965, probably Harold R. Isaacs].
So it appears your theory about it having to do with Nigeria is merely a folk (or idiosyncratic) etymology.
As Barrie England's reference indicates, it was originally neutral, and therefor not an epithet. The question that is not being addressed in any of the answers so far is the process by which the neutral term became one. The answer to this is of course is the entire history of the relationship between the white and negro races over the past 500 years or so, but I'm guessing it did not become a widely used term of derision until black people started getting 'uppity'. That is, when most of them 'knew their place' and there was no push-back, the term was neutral. Only when they began to be a 'problem' and the whites had cause for fear and resentment, did it take on the shades it has had for the past (guessing again) century and a half.