Feelings fiasco

I’m really in a state atm. Basically I’ve sorta had feelings for this guy for months and idk why. We have a weird sorta relationship, he’ll say mean things such as calling me stupid , but it’s all in a joking way and if he knew he upset me he’d apologise and make me happy. And whenever I’m upset he asks what’s wrong. Not to mention that he’s a year above me in school. I know he doesn’t like me, so why do I like him back? He’s not even 100% good looking, he just knows how to make me laugh and has a good personality.