I have studied this very question previously and it's a bit more complex than that.
Iran had a democratically elected government, but in the early 50s, the UK & US orchestrated a coup that ousted that government, since they wanted to nationalize their natural resources and kick foreign oil firms out of the country.
The U.S. the installed the King of Iran as their puppet dictator. The King was a close ally of Israel and Saudi Arabia as well.
After some 20+ years, the dictator was overthrown in the Iranian Revolution of 1979.
Part of Iran's national defense strategy since then, is to have allied forces in some neighboring countries like Lebanon, Iraq etc. These forces are not occupying the territories, they're native to the land, but just ideologically align more with Iran than other countries in the region.
This strategy exists because Iran knows it would not be able to defeat an invasion on its own, were that to ever happen.
Part of how Iran was able to attract their support was by positioning itself as the force to stand against Western abuses in the region, (including Israel).
Because Israel was an ally of the old Iranian dictator, who was hated in Iran and because their abuses against the Palestinians, it was natural for Iran to position itself as against Israeli abuses, both because of its own history and because it strengthened its image as an alternative in the region against Western abuse.
It is therefore far from true that "arabs hate them". Some Arabs hate Iranians, mostly Sunni gulf states, who supported the previous Iranian regime, but some consider them an ally, including a significant portion of Lebanon, Syria, portions of Yemen and the Palestinians.
Looking at it this way, it does at least make some sense.