What did I do wrong? Do I need to change the way I behave with men?
I can answer both of those without even meeting you.
No, you did nothing wrong and no you don't need to change (unless of course you are utterly unreasonable in your behaviours and expectations!)
The bottom line is that, the more time you spent together, the more you got to know each other, the more he realised that, despite having enjoyed your company for a couple of months, you were not the match for him.
Or he is the sort of person who doesn't make true emotional connections with people, bores easily and never intended it to be anything more than it was.
Or he wasn't exclusive and found that, as time went on, he built a deeper and more authentic connection with someone else.
It's really that simple.
Don't overanalyse and worry about what you did. When you meet the right person for you, you won't need to change the way you behave around men x