Why is my ex-boyfriend acting so immature when he was the one who ended the relationship?

My boyfriend broke up with me 3 mo ago after a 6mo relationship & meeting his parents only a few weeks beforehand. Even though I wanted to start fresh in the relationship, he didn't want to. He's been really immature about everything. He refused to talk to me, makes a big spectacle of himself, goes out of his way to avoid me (like I'm stalking him or something even though we both go to the same org) and after a guy was flirting with me in front of him he kissed a friend in front of everyone in the org we were in (the friend was really grossed out and embarassed of the whole thing) to prove a point to me (he never was one for pda). He's basically made everything really ugly with his behavior and the worst part is I still want him back and care for him. I've been really open with him with how I feel so I don't know why he's acting the way he is. I'm trying to move on, but when i think about it I want to be with him.

Why is he acting the way he is acting and is there some sort of remedy or jedi mind trick to make him want me back? lol