Why did he do this?

So I work with this guy, let’s call him D. D and I started carpooling together as he lived nearby. It was completely innocent at first as he told me he has a girlfriend of 2 years. But the banter we had was always borderline flirtatious. Then one day he kissed me before dropping me off and thing spiralled where we were making out nearly every other day and non stop texting (I know I am wrong for this and it was a shit move on my part) but he initiated it all and then he ends up buying a house with her and now lives with her. Why did he do all those things with me if he’s in a happy relationship?

We rarely speak now however if he sees me he will always flick my head or kick the back of my leg for no reason. Why do that if you have a girlfriend.

Why did he do this?
Post Opinion