The brief answer is that both terms became somewhat offensive in the 19th century, but negro (and later Negro with a capital) was deliberately rehabilitated by American black intellectuals from the 1890s through the 1930s to become the preferred polite racial term, before it fell into disuse in the 1970s.
It's unclear whether nigger ever had a neutral meaning. Prior to 1800 or so, the spelling with gg was extremely rare. Instead, the word niger was occasionally used, but (as the OED notes) this may often have been a learned "direct reborrowing" of the Latin word niger, meaning the color "black." Niger appeared as a neutral term before 1800, even in some Abolitionist treatises. However, the early pronunciation of this niger is uncertain, and thus it may or may not have a direct connection to the later offensive slur nigger, which only really begins to appear with that spelling (as well as other new variants, such as niggur and niggah) in the 19th century.
In contrast, the OED notes that "In standard English usage the word Negro had already become the usual neutral term by the end of the 17th cent."
According to Randall Kennedy's detailed book Nigger: The Strange Career of a Troublesome Word (2002):
No one knows precisely when or how niger turned derisively into nigger and attained a pejorative
meaning. We do know, however, that by the end of the first third of
the nineteenth century, nigger had already become a familiar and
In A Treatise on the Intellectual Character and Civil and Political
Condition of the Colored People of the United States and the Prejudice
Exercised Towards Them (1837), Hosea Easton wrote that nigger "is an
opprobrious term, employed to impose contempt upon [blacks] as an
Kennedy's quotations go on to describe in detail how the term had already acquired a strong derogatory association well before the American Civil War. The OED has its earliest clear citations of the word appearing in abusive senses in the 1810s.
Negro, on the other hand, never acquired this level of derogatory meaning. Nevertheless, as alternative terms came to be used among free blacks and by the abolitionist movement (notably colored), the word negro remained the more generic term associated with slavery (e.g., used in phrases like the Negro Question in politics). Perhaps due to its similar sound to nigger, some came to question its use by the mid-1800s as well. For example, black businessman James Forten asked in 1831: "Why do our friends as well as our enemies call us negroes? We feel it a term of reproach, and could wish our friends would call us by some other name."
By the end of the Civil War, with the abolitionist cause victorious, many simply wanted to leave the older terms behind. Others embraced the term negro, preferring it to words like colored which could also refer to other non-white races. A 1967 article from Ebony summarizes the conflicts of this time:
We are told, for example, that Blanche Kelso Bruce, the first black man to serve a full term in the U. S. Senate, refused to use the word "colored," saying: "I am a Negro, and proud of my race." Bruce's example was not followed by all Reconstruction leaders. In the North Carolina constitutional convention of 1888, James Walker Hood, one of 15 black delegates, denied that "there was a Negro on the floor of the Convention." Outraged and insulted, he insisted "that the word Negro had no significance as to color, but could only be used in a reproachful or degrading sense, and he further declared that no man on that floor knew where the term originated, since it was not found in ancient history, inspired or profane." In the South Carolina constitutional convention of the same year, T. J. Coghlan, a radical white Southerner, offered a resolution which urged that steps be taken to "expunge forever from the vocabulary of South Carolina, the epithets 'nigger,' 'negro,' and 'yankee' . . . and to punish this insult by fine and imprisonment."
The general sentiment during Reconstruction seemed to be away from negro, except among some groups of newly emancipated slaves. It began its long rehabilitation in the 1890s and early 1900s, led by prominent black intellectuals, particularly Booker T. Washington and W.E.B. DuBois. The long history of the term and its "strength" as a word (both in general sound and implications, as well as not needing to be paired with other words, as in colored people) seemed to be primary motivations, as DuBois argued in 1928:
Negro is a fine word. Etymologically and phonetically it is much
better and more logical than "African" or "colored" or any of the
various hyphenated circumlocutions. Of course, it is not
"historically" accurate. No name was historically accurate: neither
"English," "French," "German," "White," "Jew," "Nordic," nor
Anglo-Saxon." They were all at first nicknames, misnomers, accidents,
grown eventually to conventional habits and achieving accuracy
because, and simply because, wide and continued usage rendered them
accurate. In this sense, "Negro" is quite as accurate, quite as old,
and quite as definite as any name of any great group of people.
The sentiment had been growing throughout the early 1900s, with advocates also arguing for capitalization, to put the term on the same footing as other terms for groups of various heritage (French, Irish, Jewish, etc.). Again from the Ebony article:
By 1919, the Negro Year Book could report: "There is an increasing
use of the word 'Negro' and a decreasing use of the word 'colored' and
'Afro-American' to designate us as a people. The result is that the
word 'Negro' is, more and more, acquiring a dignity that it did not
have in the past." During this same period, there was an aggressive
campaign for capitalization of the word "Negro." This campaign, which
was led by the NAACP, peaked in 1930 when the New York Times announced
that it would print the word "Negro" with a capital letter. In an
editorial (March 7, 1930), the newspaper said: "In our 'style book'
'Negro' is now added to the list of words to be capitalized. It is not
merely a typographical change; it is an act of recognition of racial
self-respect for those who have been for generations in 'the lower
By the 1930s, academics and intellectuals commonly discussed Negro art, Negro poetry, and Negro music, and it supplanted colored as the preferred polite term in most contexts. It was used on official forms (like the census), in the names of organizations (like the United Negro College Fund), and most blacks began to self-identify with it.
The fall of Negro happened in the 1960s, with another group of black intellectuals and activists arguing that the term simply could not be separated from its use during the period of slavery. Richard Moore's book The Name "Negro": Its Origin and Evil Use (1960) was probably the first significant blow, arguing: "Its origin is vile and infamous. It began in indignity. It began in immorality, and the consciousness and the dignity of man must now rise and dispense with it forever."
The sentiment began to build among the Black Power movement and the Nation of Islam. Negro was more frequently accused of being an invention of oppressors (and suspiciously similar to the most offensive slur nigger), while black -- previously viewed as an insult, or a technical term denoting full black ancestry in the previous era that differentiated a full black from a mulatto or a quadroon or an octaroon -- was redeemed by the militant anti-establishment Black Power leaders.
The replacement of Negro was rapid and decisive. Polls from the mid-1960s show 50-70% of blacks preferring the racial term Negro, with significant numbers also holding onto colored; Black was a term mostly for younger people and radicals. But, by the mid-1970s, Black had by far become the dominant term, with 10% or less of blacks retaining a preference for Negro.
While there were arguments in certain circles to similarly rehabilitate nigger from its status as a slur, as black had been recovered from its disrespectful status, these never really caught on outside of particular uses among blacks (often still containing a somewhat derogatory or ironic sense and frequently with the variant spellings nigga or niggah).
Meanwhile, at least in the U.S., Negro now has a status varying from antiquated or old-fashioned to offensive and taboo. By the mid-1980s, it ceased to be a common term even among the old black intellectuals who had championed it; Thurgood Marshall was the last Supreme Court justice to use it. Organizations founded when the term was popular have either changed their names or sometimes avoid referencing Negro (e.g., the United Negro College Fund has stated a preference for being called U.N.C.F. to avoid the term). Nowadays, public figures who use it risk strong negative reactions, and it caused quite a sensation when it appeared on the 2010 census (and will henceforth be removed). While a small group of people apparently still prefer the term, and many others find the term unproblematic, its old associations with slavery have ultimately proved too strong for the early twentieth-century cause in favor of it to stick.
(Some other sources used here and here.)