The root cause is religious: Saudi Arabia is Sunni Muslim; Iran is Shia Muslim. A schism followed the death of the prophet in 632 and the conflicts over his succession that resulted. The relationship between the two groups has been tense to conflictual ever since, with periodic bouts of violence.
The two countries arguably are these two blocks' leaders in addition to being regional powers. Another contributing factor is that Saudi Arabia is a US ally, whereas Iran is a US enemy.
During the Shah's time:
The year of the Iranian Islamic Revolution was "one of great ecumentical discourse", and shared enthusiasm by both Shia and Sunni Islamists. [...] However, this harmony was short lived.
The reasons this harmony was short lived revolve around tensions related to Sunni discrimination and Sunni political groups being accused of Saudi support.
As to Saudi royals' attitude to Shia:
Relations between the Shia and the Wahhabis are inherently strained because the Wahhabis consider the rituals of the Shia to be the epitome of shirk, or polytheism.