Why does my guy friend treat me like this?

my guy friend who i now blocked and i met in uni, we had rooms across each other and he approached me. i am 3 years his senior and he comes from a very different social class than i do, family owns a home, siblings lawyers etc.
we developed a very close friendship but i always assumed it was platonic, never had an interest in him like that and i really thought he was just deeply closeted.
yet all last year, he would call me every morning soon after i woke up and already demanding a 40 minute phone call of unsolicited advice on his part to me, criticisms, judgement and blaming me for my problems.
he would also check out girls in front of me, which i don't mind or care, but immediately after saying "that girl is a goddess" would turn to me and say "why are you so (insert negative qualities here)". i always considered myself not his type since he always pointed out the hot/high maintenance girls who are easily 10s , so this confused me.
yet he always made very sexually degrading jokes about myself (and his other female friends behind their backs), people of my ethnic background, jokes about my mental health (like not even funny ones, joking about fucked up suicide methods) and if i brought up my boyfriend (whom he met and boyfriend's brother was also our housemate in uni), he'd always roll his eyes or comment how "codependent" i was. yet if i didn't answer his texts or one of his 3+ phonecalls in a day, the butthurt was R E A L.
all his girl friends, my friends and family who have met him, and myself included, all have assumed he is just deeply closeted as he makes constant homophobic/anti LGBTQ jokes all the time yet thinks he is "queer" because he acts differently, not realizing it's actually a sexual identification.
i recently blocked him completely after he texted my boyfriend asking about me, and this past week has been the first stress free and self hate free week i've had in a very , very long time.
what is this guy's deal?
Why does my guy friend treat me like this?
3 Opinion