https://www.washingtonpost.com/wp-srv/style/longterm/books/chap1/******.htm
Let's turn first to etymology. ****** is derived from the Latin word for the color black, niger. According to the Random House Historical Dictionary of American Slang, it did not originate as a slur but took on a derogatory connotation over time.
****** and other words related to it have been spelled in a variety of ways, including nikkah, nigguh, niggur, and nikkar. When John Rolfe recorded in his journal the first shipment of Africans to Virginia in 1619, he listed them as "negars." A 1689 inventory of an estate in Brooklyn, New York, made mention of an enslaved "niggor" boy. The seminal lexicographer Noah Webster referred to Negroes as "negers." (Currently some people insist upon distinguishing ******—which they see as exclusively an insult—from nikka, which they view as a term capable of signaling friendly salutation.) In the 1700s niger appeared in what the dictionary describes as "dignified argumentation" such as Samuel Sewall's denunciation of slavery, The Selling of Joseph.
No one knows precisely when or how niger turned derisively into ****** and attained a pejorative meaning. We do know, however, that by the end of the first third of the nineteenth century, ****** had already become a familiar and influential insult.