Welcome to the community!
I second @j_d_aengus suggestion. Do pranayama every day, preferably in the morning. And anytime you start feeling anxious, try some deep breaths.
If it helps, make a list of what your needs are. So for example, wanting peace and quiet is a need. Wanting him to go away is not a need but a possible way to achieve peace and quiet. If you say to him I need peace and quiet, he may respond more favorably but if you say I need you to go away, he will likely respond negatively. Any way, if you learn to make requests firmly but calmly, eventually you will get through to him. This can be hard and requires practice.
The key point is that you are responsible for your own well being. So if for example, you need peace and quiet, tell him so. If he doesn’t cooperate, walk away. If you are getting anxious, breathe deeply and still walk away if you need to, to maintain your focus and state of mind.
In fact, yoga has many good things to strengthen your “core”! The idea being, if you, the real you, is mentally strong, you can handle external petty annoyances well. There are some online resources, but you may have access to some very good resources locally wherever you are! [Yoga in its true meaning, not what we in the West call yoga, which are really just asanas]
[Edit:] Forgot to add one thing. If your flatmate’s behavior is toxic and you are having a lot of difficulty, have him move or you can move when it is feasible. At least until then you can try some of the suggestions. But a bigger payback will be when you learn to not only tolerate external annoyances but even can laugh at them! Just as you would if a little kid tried the same things! Good luck!