Don't let it slide, raise the issue to HR if you need to.
If it doesn't end, go find another job where you can grow and just leave. Don't look back. Working with people like this is very poisonous in lots of insidious ways, and ultimately never worth the stress
It's also hard for outsiders to tell who is the jerk when two programmers don't get along. It's often both of them.
This profession attracts a lot of people with low social skills, on or off the spectrum, so this stuff is hard...
You might also try to take a step back and see if their behavior actually matters, and treat it as a personality quirk. There are people like this everywhere, so even jumping ship may not exclude this or worse from happening at the next place.
Just don't mention that you're thinking about jumping ship to anyone. That doesn't help you or them.
Sometimes people are just assholes. Sometimes people are a lot alike and that actually causes friction. In those cases, it's possibly to transform a "rivalry" into a friendship if you work at it.
But if they really are just an asshole, then ya, the advice in the other people's comments make sense. Just make sure you at least try to bridge the gap first.
Otherwise, if they are a good person and the friction is not due to them really being an asshole, going to your manager or HR could end up drastically eroding the trust to the point of being irreparable.
—https://www.miltonglaser.com/files/Essays-10things-8400.pdf
Initially I ascribed the somewhat rude way he acts to a psychological trait (I'm positive the guy has Asperger's), but then I started noticing it was more targeted at me.
Looking back, tolerating this behaviour was a disservice to both me and the company I was working at. I lost many things professionally because of that. Do not make the same mistake. The guy might be super clever, super efficient and very knowledgeable. That does not give him the right, though, to destroy people's lives. And if you tolerate this, keep in mind that there will be also others in your position later.
Btw, the description you provide matches pretty closely the guy I knew. Super smart, Asperger's and I was his victim. Before me, there was another person who was holding him in very high esteem but was also forced to resign, partly because of the unsupportive environment.
Going to work and having to sit next to someone like that every day is quickly making me think of jumping ship.