It's probably a manifestation of the ancient belief that words have power. It's not a reaction to the meaning or content of the words (if one uses a synonym for a swear word, a lot of the mystical impact is lost). If it was, then we would expect that words like "murder" and "torture", would be considered to be much more offensive than words like "f**k". No, it is something special about the words themselves, the particular sound they make, which is somehow arbitarily elevated above all other sounds. If you say "f**k" in a crowded room, it has a dramatic almost magical impact, something completely lacking if you were to instead say "the Armenian genocide". Swear words have their effect only because people on some level consider that there is something 'magical' about certain words.
The commandment about "taking the Lord's name in vain" is a prime example of this. Contrary to widespread belief, it does not refer to using the name of Yahweh (or later Jesus) as a curse word. In the time it was written, it was believed that if you knew an entity's true name, this gave you power over them and the ability to command them. This is a prominent theme in the mythology of the region; for instance in Egypt it is explained that Ra was forced to become the sun god and let Osiris rule the Earth, after Isis arranged for him to be bitten by a magically conjured serpent, and refused to cure him of the effects of the venom unless he revealed to her his true name. Once he did so, she was able to banish him to the skies. Likewise, in Israel, it was a fairly common practice to use the name Yahweh in magical incantations, using his name to make him do the bidding of the sorcerer. The third commandment was designed to combat this practice, and in Israel it it was forbidden to use the name Yahweh at all, except for the High Priest who was allowed to use it once a year as part of a special ceremony. Using the name of Yahweh or Jesus as a curse word is not what is meant by the third commandment. However, plenty of Christians do manage to break it unwittingly - just think of any occasion in which somebody has made a prayer "in the name of Jesus", trying to make him do some favour or other for them. Pretty much any prayer which uses the name of Yahweh or Jesus and attempts to make them do something for the person praying is a violation of the third commandment.