Guys, what did I do wrong with my guy friend?

Lets call my friend S (he is 22, I am 24). We worked together and would take breaks together and I started cooking for him and bringing him food. Texted each other pretty frequently. When I met him, he was fighting with his girlfriend and he broke up with her (together 10 months, broken up a total of 3 times). We kinda talked about it, but mostly just friends talking about motorcycles and work bullshit and teasing each other. It did get a little flirty, but he never made a move and I feel I didn't really encourage anything. He took me for 2 rides on his bike which was really fun.

He ended up getting back together with his girlfriend and sent me a long text saying he was mutually exclusive with her and hoped he hadn't led me on. I responded saying "led me on? I thought we were friends!" and told him I was happy for him. Then I went to his house to return a sweatshirt he had let me borrow and he was so stiff and kinda cold towards me. Didn't want to talk much, I asked if I could just hang with him for 20 minutes and talk and he said no. I texted him later saying basically: you don't have to feel awkward around me if you can lets hang out Monday--radio silence.

Is this just because he is trying to draw lines and be all loyal to his girlfriend? I would understand that, but we were just friends. We never talked about dating each other and I feel like we can still text and hang out, I would meet his girlfriend/hang out with both of them if they wanted. But he just dropped me so I guess we weren't really friends? So confused. I just moved here so I don't have many friends.

I would feel comfortable if my SO had an opposite sex friend as long as I met them, and my SO communicated with me clearly. Maybe I am biased because I have always had guy friends and I have been friends with guys with zero sexual interest from both sides.
Guys, what did I do wrong with my guy friend?
Add Opinion