The first step is to review the reasons kids swear and determine which one is the fuel for your child's fire. Often, a parents shocked response will actually encourage a child to repeat foul language. If the child persists, choose a quiet time to express your feelings, and set specific limits. Discuss why people swear, define what swear words are, and explain why they aren't acceptable in your family. Teach acceptable alternatives.
Some kids have a hard time understanding and expressing their angry feelings.
Their lack of wisdom leads them to believe they are the only ones who ever feel this way, and that their feelings are wrong or bad. It helps kids when we allow them their angry feelings, even as we set limits on their behavior. It's a healthy way for him to express his feelings. Kids are going to get angry. You need to teach, coach and model the correct ways to respond to those emotions.