Like others have said before he either:
A: Has a history with the girl and is uncomfortable sharing the past experiences
B: Has secret feelings for you
C: Doesn't was to be 2nd best
But by his behavior, I gather that he could be an attention whore. Believing that negative behavior, and actions towards you will make him the victim and you the baddy. You realize you were wrong and a total monster, dumping your girlfriend and running back to him, begging for forgiveness dramatically played out in his head. This also lease me to believe that letter "B" has a role in all of this.
I can understand him being a little jealous and feeling a bit shoved to the side since you have a girlfriend. (that's what happens to best friends when their other friends have boyfriend/ girlfriends) But he is going overboard. I have HATED (with a passion) one of my best friends girlfriends before, but I never acted like a little shit to him like your friend is to you.
Best advice: First thing's first. Who is more important to you? Your best friend, or girlfriend. If you choose girlfriend, then just dump his ass and find a new best friend. If you choose best friend (I would hope) go meet with him personally. Go to his house and just sit down with him. Granted, you may need to play along with his ideas and let him know that you were wrong, but that will help you get to the bottom of all of it. If that doesn't work, ask around his other friends and see if they know any history of your friend and girlfriend. Eventually, you are going to have to confront him. Say what you need to say, but let him speak first. If you get nothing out of it, sorry man.