Girlfriend mad at me for getting mad at guy who was flirting with her?

So some guy was flirting with my girlfriend over text, she made it clear to him that she was seeing someone but he continued going at it but eventually stopped from what I know, still not sure why she responded anyway.

i saw the guy at my school and made a comment to him nothing bad but I made him know I knew about what he was doing and didn't like it but I didn't cause a commotion. I told her that I saw him and said something and she got mad at me for saying something and said she could stand up for herself. Am I in the wrong?