Following on from the comment by @Bruce Murray.
The technical term for this is euphemism. Specifically this is a case of phonetic modification. Something that is said that, on the surface, sounds innocent but which is similar to a word that would be unacceptable in polite company. See below for further explanation.
Types of Euphemisms Within the definition of euphemism, there are many
different sub-categories. Here are some of the different types of
euphemisms:
...
Phonetic modification: We modify strong swear words or words that are
not meant to be spoken lightly (i.e., God or Jesus) so that the new
phonetic euphemism sounds very similar to the original, but just
different enough so that it’s inoffensive. Modifications may take the
case of shortening the word or expression (Jeez, What the);
intentional mispronunciations (shoot, shut the front door, dang,
fudge); or using an acronym or one letter to represent the curse word
(WTF, B-word, A-hole).
http://www.literarydevices.com/euphemism/
Note
For those not familiar with English, I'll explain some of the above.
shoot ---> shit
dang ---> damn
fudge ---> f*ck
The point is that the listener is fooled into thinking the actual word is coming but then a slightly different word is actually spoken.