This most offensive of words in American speech dates back to the late 16th century, although the modern spelling doesn't appear until two centuries later. The OED2's earliest cite of the modern spelling is from 1786 in Burns's Ordination. (The Random House Historical Dictionary of American Slang, however, claims that this is an editorial error and Burns's original manuscript uses the older niger.) The obsolete spelling niger dates to 1574. It derives from the Latin niger meaning black. It shares this common root with negro.
http://www.wordorigins.org/wordorn.htm