In terms of writing, Overwatch is just... so ill-equipped to tackle geopolitics and racial discourse. It's so funny seeing how hard they came out the gate swinging on 'omnics are just like racial minorities' at first with the shorts showing pro-omnic-love protests and omnic assassinations and omnics getting beaten in the streets and all the dialogue of Zarya being omnic racist. And then they just sorta pulled wayyy back in recent years.
So the reason why humans hate omnics is because of this massive, global war of extermination carried out by omnics, who attempted to commit mass genocide on all of humanity. And this is in recent memory. Anyone over the age of 35 would remember their town/city getting raided and bombed by omnic forces. Why did they attack? Who knows!
(Quick note, but I believe this entry in the wiki misinterpreted its sources. The Omnic Crisis was probably not made up on the spot, but the point still stands that after 8 years the writers have not disclosed anything about the single most important moment in their lore. I wouldn't be surprised if they didn't know either).
Overwatch is formed, they defeat the evil omnics (different from the good ones), geopolitics happen, Overwatch is disbanded, evil omnics are still attacking. All the while, omnics become oppressed second-class citizens in most major cities, forced into slums and poverty and met with constant violence. Radicals such as Ramattra come to power, believing that violence must be met with violence (common trope of radical minority rights leaders going "too far" as to vilify them).
One important thing to note: omnics, unlike humans, can be hacked and made violent through the removal of their free will. This is seen in Pharah's comic, where a highly advanced security droid is hacked and forced to almost fire upon its own squad/commit suicide. At any point, a civilian omnic could be made a weapon of war without any nuance (this literally happens).
So there's already a problem with the allegory. Omnics =/= Humans. But mannn, that's still no reason to hate and discriminate omnics. That genocide was decades ago. It's not like, I dunno just spitballing here, a SECOND Omnic Crisis will happen.
Overwatch 2 is about the Second Omnic Crisis.