I don't want to contact HR because I know they'll probably fire me when time comes because they love mediocre employees as they can pay less salary to them.
Otherwise, don't fear HR. You're too valuable to be replaced by a cheap (and inexperienced) intern.
Usually there is also a feeling from the instigator that the targeted individual doesn't deserve X or Y, and therefore deserves disdain, scorn, or whatever they consider appropriate.
The best thing you can do is demonstrate firmly that you are as good or better at whatever they are using to make you feel bad or discredit you. You also have to be firm that you don't welcome or tolerate such behavior, and so should be your coworkers, manager, or higher-ups. If they aren't being explicit about not tolerating such behavior, depending on the applicable jurisdiction, they might be putting the company in legal jeopardy.
Never contact HR; better is a union.
Take him in front of your boss and tell him that you noticed his hostility and want to know if anything is wrong with you in the most calm and friendly way possible. Bonus points if the boss looks concerned about his workplace wellbeing.
Have you made it clear to him that you're both problem solvers working on a common goal where each can and will succeed overcoming the many challenges overhead.
There always are nasty people in the world. Why not be extra nice to him, tell him his talents are not being adequately recognized. Maybe he'll find another job. Why should it be you who leaves?