This sounds so much like my DS16 at 12. Before I offer solutions I want to say is that at 16 DS is a very different person and some portion of that I credit just to maturity. The preteen years have are HARD, the changing hormones in their bodies make experiences more intense. I know it seems hard right now but with patience you too can have a mature polite teenager. I can't explain how proud of DS I am these days. He has come a long way from a the rude, introverted, anxious and depressed 12 year old.

But I agree that these behaviors can't be tolerated kids need to learn how to behave in a socially acceptable way and that you can't just ignore this. I ended up taking my DS to a psychologist at that age because he has anxiety disorder that was getting in the way at school. The psychologist helped by teaching him how to take control of his anxiety. Helped us agree how to respond to these situations. I found this really helpful. He really needed a 3rd party who wasn't so emotionally invested in the situation. Punishing by taking away electronics & other things usually backfired and made things worse. We learned to treat this as a manifestation of his stress and like others have mentioned DS would need to go somewhere and calm down.

What I found the hardest was other adults interfering who thought I just wasn't punishing him enough or the right way. I had relatives who told him to his face he was a rude little boy. It was frustrating because I was working with him and comments like that made things worse. Very frustrating and embarrassing for me particularly as I didn't feel like sharing all the details to every adult who came in contact with him.

Not sure how helpful my suggestions are but mostly I LISTENED to my kid, tried to find ways cope for him to cope with his anxiety, made clear cut expectations WITH him for what we would do before he blew up, and minimized the situations that would set him off.