It's the right hemisphere that swears.
Strangely, there are in the right hemisphere words and phases as they appear in songs or over-learned cliches and expressive epithets.
More like songs than language, these are pretty much set in their order and tone.
Hence, when I have a severe injury to my left cerebral hemisphere, I may find myself unable to use words to explain my plight or to understand what is being said to me. But, in my attempt to speak, in the absence of language, swear words may stream out, even to my own amazement.
(I may never have used these words before in my life, but perhaps having had teenagers, I may have heard them, and that is enough!).
In other words, when I have lost language ability, I may still be able to say many of those phrases that are not language, such as swear words, old songs, formal expressions (e.g., "How are you?") and recitations...