Do not hate your brother in your heart… (Leviticus 19:17)
This mitzvah is not what many people think it is. What’s prohibited here is to hate another Jew specifically “in one’s heart” – that is, secretly. It’s wrong to pretend to be someone’s friend while you secretly loathe them. (Of course, while hating someone explicitly would not violate this prohibition, it would still be contrary to our obligation to love one another, which we’ll come to in Mitzvah #243.)
By saying not to hate “your brother,” it means that we’re only talking about people who are “in good standing.” It’s okay to hate evil people like rapists, murderers and the person who embezzled 34 million dollars from your company and ran away to Tahiti with the money. In fact, one should despise those who show disdain for God as per Psalms 139:21 (“Hashem, don’t I hate those who hate You…?”).
The reason for this mitzvah is clear enough: God wants us to love one another. If we can’t love one another, we should at least be honest about it. It’s much better to be upfront and say, “I have a problem with you” than to smile and seethe. That leads to backstabbing and betrayal. Secret hatred increases animosity rather than eradicating it or covering it up.
This mitzvah applies to both men and women in all times and places. In the Talmud, it is discussed in tractate Arachin on page 16b. It is codified in the Mishneh Torah in the sixth chapter of Hilchos Deos. This prohibition is #302 of the 365 negative mitzvos in the Rambam’s Sefer HaMitzvos and #78 of the 194 negative mitzvos that can be fulfilled today as listed in the Sefer HaMitzvos HaKatzar of the Chofetz Chaim.