You can see you pushed him to the edge of leaving you.. He had, had enough.
But, you can also see, 6 weeks later, he was back trying to win you back.
During those 6 weeks, he would have gone through alot of emotions, you don't say how old you are but 2 years together is a long time, companionship, faithfulness and him given grief from you, you weren't fair, would be a lot for him to consider and think about before deciding if he could or could not be with out you.
He decided he couldn't.
In-between, you should know what girls are like, flirting, playing it on, drinking, happy for a one night stand.. You should understand what a guy is like when he has walked away from someone from two years, but still has feelings, drinking, flirting or accepting the flirt, feeling wanted, and accepting a one night stand.
The fact of the matter is, he left, you gave him shirt for some time, you know why he left but you were not together, simply put, there at that point in time was no relationship.. So he was a free spirit.
Yes, a man can for the same reasons women do crazy things, it's called emotions or wanting to feel loved again, even for a night and sex is intimacy and it can at least drown the sorrows or make someone feel something, until they wake up the next day.
Be grateful he isn't a cad. He told you.
Understand you were'nt together you have no right honestly to give him grief over this, he has been honest with you...