Why does my ex hate me?

My ex and I broke up mutually, we both weren’t happy. He has his own personal issues. He’s immature and said he would be made until the day he goes back home, which is in 2 months. His mom left him here (the state we live) and went back home without him. Yet, he is still mad at the entire world for no reason for something that will come hella soon. He hurt me numerous times with lying, flirting with other girls, and other things. When I got upset at him for lying, he never saw his own faults. When He flirted, I let it go. Anyways, we agreed to be friends and for a day, it went okay. But after afterwards, he started being extremely rude to me. He is on the same tennis team as me, so I have to face him everyday. He always gets in my conversations and tries to somehow make me look bad or one-Up me. Why does he do this? I try to be a nice person and treat him like any other person, yet he still hates me. Why?