It has its roots in Latin back to the Roman Empire
What is the Latin word for black?
Latin words for black
ater atricolor
carbo furvus
niger nigrans
nigrum, perniger
pulleiaceus pullejaceus
nigredo teter
nigrum nigro
nigris
People from some regions would often call potatoes taters or call windows winders. I imagine the n-word was created just because of laziness in speech.