It's more a personal thing than a chess thing. And I don't even mean a personality flaw. I can easily imagine a great person having a bad day at work, a fight with friends or family, etc. then they get online to play some blitz to relax, and all that frustration is released in the chat. At the end of the day it's better to type in all caps "**** YOU" than it is to shout it at your boss or spouse or etc.
But if it's only a chess thing for you, then I'd say try to think about the bigger picture. When I blunder my queen due to a mouse slip, I expect to lose. I will probably resign right away. Even if it was a great game up to that point, I'm only mad at myself for ruining it. So when someone mouse slips their queen against me, too bad. You lose now. Nothing personal. So in my point of view it tends to all even out. You win some by luck or circumstance, you lose some by luck or circumstance... once my dog (40 lbs) wanted to be fed and he jumped up on my lap while I was playing bullet (he never does this) and knocked the mouse to the floor lol. Sometimes crazy stuff happens. Just let that game go and move on to the next is my advice.
But if it's a non-chess issue, like your job sucks, your marriage sucks, or something like this. That's totally different... and like I said it's better to type nasty things to an anonymous stranger than it is to shout it at people you see every day... so in that case maybe don't feel so guilty about it, and if you want to change it, then try to resolve these other issues.
I love chess. I like every body, and I wish harm on NO ONE. But I have one admission to make, I am a sore loser. I am not your average sore loser. I can take losing, but sometimes it becomes too much, and it sometimes culminates in me being rude (to put it lightly). Several years ago, I used to get mad really easy and be really mean with my insults, then I tried to control it and tried to thank the opponent as hard as it seemed. The thing is, sometimes it is hard, I can handle losing a game, smiling and saying "gg" most of the time. But there comes a time when I am playing the opponent, dominating him, and suddenly I mouseslip a queen, I explain that I mouseslipped but they won't even accept a draw. At this point I feel physical pain inside me. Cursing helps me alleviate that feeling. I do have some limits in my rage. I never insult based on race, I do not get creepy, I do NOT wish them death or go way too far... But it just numbs my pain a little when I know my opponent read that "*(&# you!" I thought this was only an amateur problem, but I see that even top GMs suffer from it. Magnus Carlsen has behaved like a sore loser, memorably when losing game 8 of 2016 FIDE WCC to Karjakin. Hikaru Nakamura also has problems when losing on chess.com. He is known to rage quit and let the time run out and has even accused people of cheating baselessly. What are the best ways to deal with the pain that makes you want to break your mouse or take pain medication? Thank you!