The linguistic processes are technically called Taboo (in this case, Taboo words) and Euphemism, which is substituting a non-taboo word for a taboo word, like saying

  • What the heck

intead of

  • What the hell.

The way it happens is that there are always taboos on certain terms and topics in every culture. These taboo words are the healthiest words in the language, because everybody has to know them, in order to avoid saying them.

(If this sounds crazy, that's because it is -- taboos are unconscious, and not really subject to logic. After all, words by themselves have no powers; it's human culture that produces taboos.)

Anyway, people do need to talk about things, even if it's forbidden, so we substitute "safe" terms (like water closet or crapper or toilet or washroom or men's room or bathroom, instead of "place where one shits in private"). These euphemisms have a short half-life, since once the substitution strategy is detected, the euphemism gradually becomes taboo itself, and is replaced by another euphemism, while the original taboo term goes on forever.

Derogatory, politically (in)correct, profane, vulgar, racist, sexist, and other terms that are applied to language chunks are simply descriptions of the variety of taboo that the terms in question are said to be breaking. They're not categories of words so much as social infractions, which is (luckily) not a matter of grammar.