Emotions are opinions. Emotions are not right or wrong, they are harmful or helpful. Sometimes it is very tempting to react on an emotion such as anger and it is very important not to suppress our emotions or ignore them.
The fact it's generally not a great idea to suppress our emotions does not mean we should always act on them. Another option you have is acknowledging them and processing them.
You are not just your emotions and you are not your thoughts. If a girl irritates you in class you do not have to choose to act on it (which could be harmful).
Think and stop about what you actually want.
The situation of being talked down to in front of the class is challenging, hard and angering. Your feelings make sense and are legitimate.
Please try to see things from her perspective. Do not assume the girl was being mean on purpose or that she is not a decent human being. Always try to assume good faith.
Definitely do not resort to physical (or verbal) violence - it sounds very tempting and like it would help you deal with your emotions but it would likely accomplish the opposite result and just make you angrier.
What you should do
First of all. I would avoid things like "Should I get angry?". You did get angry - that's fine, anger is a natural and healthy part of life. Try to accept your emotions and own them - you do not have to feel guilty and ashamed for being angry. Not ever and not in this particular instance (which is quite angering!).
This is hard - typically a healthy routine (regular sleep, healthy food, exercise) really helps with being balanced and being better at accepting our feelings.
I've also found meditation to help a lot with this. There are some apps (like Headspace and Calm) you can check out and there are online tutorials that help with this.
You don't have to do anything
You can (and should) acknowledge your anger and the fact you were in an annoying situation but you don't actually have to do anything about it. This wasn't your fault and was not in your control.
Also about being late - sometimes we are late, don't judge yourself too harshly because of it and don't label yourself as "someone who is late". Try to figure out why you were late and see if you can address that part. It might be organisational skills or time management skills you can work on (when I was in school I had neither).
If you still want to do something
Do not blame the girl for being "mean" (or "nice"). Putting labels on people, even if they are positive isn't great since it puts them in a box. She is just who she is - she isn't "mean" or "nice" she might just do mean or nice things sometimes and maybe sometimes she is aware of it.
Instead if you want to address it with her I would try something like:
Hey, today in class I was very stressed because I got in late. I was very anxious to get in time. I consider you a person who does nice and kind things often. When you shouted "get out of here!" at me in class it made me feel very unwelcome and it made me hurt and angry. Do you think we can sit down together for 30 minutes and you can explain why you did that to me? I promise not to be judgmental and listen.
Sharing feelings and showing vulnerability was way above my ability when I was in school and it took me years to be able to have this sort of conversation. So remember you don't have to do this and if you don't that's absolutely fine.
Now, if she says "yes" then sit down and listen. Accepting criticism is hard but remember - the goal here isn't to "win" vs. the girl but to improve yourself and resolve the situation. Do not attack her, do not disagree with her criticism - just listen.
If you want to do something and don't want to talk to her
You can talk to your teacher:
Hey, when X told me "get out of here!" today it made me feel very angry. I feel like I have issues in class and am struggling. It made me feel unwelcome and insecure about my place in class and it made the class room feel very hostile and unwelcoming to me. I was already very anxious and stressed because I was late (which is something I am struggling with and working on).
I think this isn't a great option because it deprives you of the opportunity to deal with your issues with the girl or yourself directly (again, you don't have to do anything and your feelings are valid and normal).
It's perfectly valid - remember to focus on solving the issue (and not winning).
I would really focus on what you want to accomplish. You deserve to feel safe and be happy in school. School is a very challenging and stressful time for a lot of people (it was for me).