Is there a concept of swearing or saying bad words in Hinduism? Is it considered as a sin?
Vidura mentions this twice in the Mahabharata
To control speech, O king, is said to be most difficult. It is not easy to hold a long conversation uttering words full of meaning and delightful to the hearers. Well-spoken speech is productive of many beneficial results; and ill-spoken speech, O king, is the cause of evils. [link]
'Dost you not know, O wretch, that by uttering such harsh words you are tying thyself with cords? [link]
It is most explicitly condemned in the Manu Smriti:
Abusing, lying, calumniating all men, and idle prattling,—are the poor kinds of ‘verbal action.’
And in his commentary, Medhatithi tells us:
‘Abusing’—uttering of words causing pain to others.
‘Calumniating’—detracting from the merits of others, on account of jealousy.
‘Idle prattling’ and‘telling an untruth.’—(6)
So these lines tell us to speak gently and kindly, not to abuse one another, and not to utter 'harsh words'. We can interpret this as referring to profanity as well.