The school year is nearly over. I hope you aren't just now finding out about this. Yes, make it a learning opportunity-- but also be sure they aren't together next year.
I would let this go with so little of school left, but I would at the same time write to the principal now and say you want to ensure your son and this boy are not put in the same class together when the school assigns students to classes for next year. The schools often start forming class lists in late spring and during the summer, so write the letter now.
You have every right as a parent to do this; I know several parents who have written to principals asking that their kid be separated from another kid when being assigned for the next school year (and sometimes the parents want the kids separated not because of some problem but because the kids are such good buddies that they distract each other). This is really fine to do. Schools see it all the time. Most of these requests get honored.
However, do not go into details about what the boy draws or says or does. Just state that you are asking formally that your son and the boy not be placed in the same class next year. Then hand-deliver the letter to the school; also e-mail a copy to the principal; and follow up the next day to ensure the principal received and has seen the letter and/or e-mail version.
If your school posts class lists a few days before school starts, be sure you go to school to see the list and if the boys are put together despite your request, go to the office and show them a copy of your letter and say that you want one of them moved. This happened to my close friend -- she had requested in writing that her son and another boy not be placed in the same class, but when the lists were posted a few days before school began, there they were in the same class. She went right in and calmly but firmly told them that she had made a request months earlier. They fixed it before school began.
I do agree with others that it's very important that you equip your son with things to say and do so that HE can deal with kids who are just being jerky. He also needs to start learning that friends do not do things that make you uncomfortable and friends do not tell you to say stuff that gets you in trouble. That's a tough lesson that can take many years for a kid to learn but this is the time to start.
Role-play with him where he says the things that this boy says (modified of course so he isn't using obscenities outright) and then you model how he can react-- "Stop that, I don't like that kind of word" and walking away, or "I have to leave right now" and then doing so. Then reverse roles -- you be this boy, and he shows how he might better react to the boy.
Yes, kids need to learn to navigate stuff on their own, but at seven he is likely not yet ready to do so entirely alone. So role-play with him, and ensure that the school separates them next year. School is too important to be OK with letting a kid be around another kid if that friend is a real distraction; the focus has to be on the classes and the work. They might end up in gym together, or music class, etc. depending on how the school structures classes. That's fine. But I wouldn't let fate decide whether they'll be together in their main classroom.
Your son might actually see this "forbidden naughty knowledge" as kind of cool and might even think his friend is so interesting and tough. That's attractive to a kid and hard to fight. So don't tell your son you're asking that his friend be in another class next year. That will only make his friend more interesting as forbidden fruit.
One great thing here, mom: Your son told you what was going on. Keep those lines of communication open and thank him and praise him for telling you what this boy was saying. Then drop it and move into summer.