The reason? Honor.
As always, it is useful to look at the conflict through the lens of honor/shame.
Iran looks at itself as the ever-growing superpower in the Middle East. Over the years it has gained control of Lebanon, Syria, Yemen and Gaza, as well as significant influence over Iraq and West Bank cities like Jenin. It has imposed its will on the West. It is now a partner with Russia.
A loss in Gaza would be a tremendous loss of honor. It would symbolize a reversal of fortune for the Iranian "axis." The Muslim world, they believe, would lose respect for Iran since they respect the "strong horse."
As the article says, "The Iranian axis would lose its political discourse forever, and will begin a path of decline at the political and popular levels, not just the military level. "
Moreover, if Gaza is lost - Iran thinks - a voracious Israel would then turn to Lebanon and Syria to defeat Iranian proxies there.
The reason this may turn into a major regional conflict is that Israel cannot afford to lose - and Iran believes, because of "honor," that it cannot afford to lose, either.
One other factor may be Iran's own propaganda. According to polling from the regime, 77% of Iranians support Hamas in the war. Iran's anti-Israel rhetoric has been extreme for decades, and Iranians who believe it are growing up with that hate, and itching to go to war to destroy Israel.
The Deputy Commander-in-Chief of the Revolutionary Guard, Brig.Ali FadwaIn front of a crowd of university students in Tehran, who organized a gathering in support of Gaza, said that “the Resistance Front’s hand is on the trigger, and this country is capable of practical and direct action with the push of a button, after which rockets would rain down on the occupied territories.”In response to a student’s question about the possibility of Tehran actually participating in Operation “Al-Aqsa Flood,” he responded, "Some people believe that the practical move is to launch missiles directly towards Haifa. Yes, we will implement that with certainty and freedom if necessary."
Historian Benny Morris wrote in Haaretz that this is Israel's best chance to attack Iran directly. I don't know about that, but the world must recognize that this isn't an Israel/Hamas war - but a war between Israel and Iran. Only Iran can decide to escalate or cool things down, and the Western world must start doing its part diplomatically and politically to make sure Iran knows that if it expands the field, it is not only Israel they are fighting.