Hatred usually stems from fear, and fear comes from a lack of understanding of the unknown and/or the unusual. Sometimes those who are afraid, are not just worried for themselves, but for those around them as well, because they care and love them and don't want them to be in danger.
For example, racism against Muslims could stem from a subconscious fear of terrorism, something that ignorant people have unfortunately pinned on Muslims because of the false "Muslims are terrorists" stereotype. Such fear is for the safety of themselves and their loved ones, they don't want any dangers to befall them, and so in their ignorance and a lack of understanding what they don't know, they lash out against the "threat" with hatred and violence. It may be the wrong thing to do, but one may be able to see the reasoning behind it.
To conclude, there is hatred in this world because there is love in it as well. It's a bit "yin and yang", I know, but it's how I like to see it, kind of a "glass half full" perspective. I hope this answer helps. Have a nice day.