What were his motivations for starting a war that would prove to be so costly?
From an earlier answer of mine
Part I
Although it is tempting to reduce the war's origins to an atavistic land grab by an opportunistic Saddam Hussein, and this certainly was an important factor, the Iran-Iraq War had multiple well-springs. Iran-Iraq relations were characterized by tensions from the establishment of Iraq in 1931 and these tensions periodically escalated into border clashes and diplomatic attacks on the other. But beyond these long-term historical causes, much of the groundwork for Iraq's invasion was laid in the 1970s.
One of the major underlying casus belli was the division of the issue of sovereignty over the Shatt al-Arab waterway that bisects the southern Iran-Iraq border. Control of these waters, and the right to extract tolls and other economic concessions, had been a bone of contention between Iraq and Iran for decades and the diplomatic treaties resolving the issue had a very short shelf-life. The discovery of oil in the region, as well as the importance of the waterway for the export of oil out of both countries, exacerbated the tensions between the two neighbors. The latest diplomatic arrangement over Shatt al-Arab, the Algiers Accord of 1975, was somewhat favorable to the Shah and was a diplomatic humiliation of Baathist Iraq. Both sides pledged non-interference in the domestic affairs of the other and the Shah's negotiators succeeded in getting the placement of the partition line of Shatt al-Arab according to the 1913 Constantinople Protocol.
Iraq signed this accord after pressure from fighting Kurdish irredentists in Kirkuk, which in 1974 had become something of a proxy war between Israel, Iran, the US, and Iraq with the former all giving support to Kurdish separatists. Although both the Iranians and the US officials were alarmed at the prospect of escalating their proxy war in Kurdistan as such escalation could lead to either a full war or further drive the Iraqis into the Soviet camp, the signing of a treaty was a public diplomatic setback for the emerging dictatorship of Sadaam. Iran, with the apparent blessing of the US and with Israeli collusion, had interfered with Iraqi domestic politics and paid no apparent penalty. Beneath the cordiality of post-Algiers Iran-Iraq relations, the Iraqi state sought to acquire more weaponry and built up diplomatic connections outside the superpowers to better counteract the lavishly-equipped forces of the Shah. Less than a week before the official invasion of Iraq in 22 September 1980, Saddam unilaterally abrogated the Algiers Accord and publicly declared that:
the legal status of the Shatt al-Arab must return to what it has always been historically, and what it should never have stopped being, that is to say an Arab river that allows Iraq to enjoy all the rights ensuing from full sovereignty.
Sadaam's abrogation of the treaty was not only a diplomatic provocation towards the nascent Islamic Republic, but also a statement outlining the somewhat nebulous pan-Arab goals of Iraq's war of choice. The Algiers Accord fit into a larger pattern in which Iraq had been diplomatically sidelined by the major regional and global powers in the 1970s. Iraq's participation in the 1973 Yom Kippur War and its sponsorship of various Palestinian armed groups had won it very few friends in the West and not reaped many rewards in the Middle East. The Syrian Ba'athist President Hafez al-Assad had emerged as the Soviet's most favored partner in the region and Iraq-Syrian competition and diplomatic sniping at each other was one of the hallmarks of 1970s Middle East diplomacy. But the Camp David Agreement had given the Iraqis an unprecedented opportunity to again take up the flag of pan-Arabism as Egypt's peace with Israel made Sadat a pariah among a large swath of Arab public opinion. This opportunistic attempt to revive pan-Arabism gained even more currency with the advent of the Islamic Revolution in Iran and the ascent of Khomeini, which frightened a number of the Gulf oil states with the spectre of Shi'a irredentism. By virtue of geography, Iraq was well-placed to present itself as the champion of the Arab world against the Persians, but also place itself ahead of Syria as the paladin of progressive Arab politics against Islamism.
Yet there was a strong domestic component to the Iraqi post-Revolutionary hardline towards the new regime. The Revolution coincided with Saddam's increasing monopolization of power inside Iraq and the cementing of Ba'athist political hegemony in the country. In early 1979, Saddam had made the Shi'a Dawa party illegal, and while this was partly a reaction to the Revolution, it was part of a larger policy of formally outlawing other rival parties like the Iraqi Communist Party (ICP). The prominence of Saddam's cult of personality also began in this period and both became frequent targets for invective in Tehran against the Saddam regime. Refugees from the Dawa Party found a haven in Iran and Khomeini's speeches against Iraq placed Iraq as one of the Revolution's chief secular enemies. There was a fear, either real or manufactured by Saddam's security forces, of Iranian-sponsored terrorism inside Iraq. In April 1980 Tariq Aziz survived a bombing attack at Baghdad University and other homemade bombs went off inside the city. Iraq denounced the attack, which led Tehran to double-down on its anti-Ba'athist invective. For example, Iranian President Abol Hassan Bani-Sadr denounced Ba'athism as "no more than an amalgamation of Nazi, Fascist, and Marxist doctrines."
The continued presence of the Revolutionary government underscored the need for Iraq to intervene directly. There had been several coup attempts against the Iranian regime, most notably one centered around air force in July 1980, but the Republic had been able to thwart them all. As Saddam made the decision for war, he shopped the idea around the region to bolster support for both an Iraqi invasion, seize oil-rich regions along the Shatt-al-Arab, and to set up a new, Iraqi-dependent regime in Tehran. For its part, Islamist hardliners in Tehran were no less willing to tone down the anti-Iraqi rhetoric and war with Iraq became accepted as something of a strategic inevitability and a possible boon as it would shore up the Revolution. The Iran-Iraq border became the sight of various pinprick attacks on both sides in the year prior to the Iraqi invasion and cross-border incursions would feature heavily in Saddam's public justifications for the invasion. The Iraqi army's officer corps, although now heavily composed of Ba'athist loyalists, also began to expect the inevitability of an Iran-Iraq war, although it accomplished incredibly little in terms of actual strategic planning for hostilities. As Iraqi Republican Guard general Ra'ad al-Hamdani explained in a post-Iraqi Freedom interview:
the decision to go to war with Iran rested on several assumptions. the first was to prevent the exportation of the Iranian revolution to Iraq. the second was that the new Iranian army at the time was still in the early stages of formation, while the shah’s army was dissolving. This presented an opportunity to attack when [the Iranians] were weak. The Iraqi leadership figured that if the Iraqi armies advanced approximately 10–20 kilometers deep into Iran along the borders, Khomeini would have to send [Iranian] forces from the surrounding area of Tehran to the borders. this would leave Tehran exposed, and give the opportunity to the Mehdi Bazargan group [one of the Iranian factions opposed to the hardline turn of Khomeini] to revolt against the religious leadership and gain control of Tehran. So the idea was to bring the militia out of Tehran to weaken the revolution for a counterrevolution.
The generally poor preparation of the Iraqi military gave the Iranians much needed breathing-space to organize a defense and shore up the regime at home. Ironically, and somewhat fittingly, the Iranian invasion only furthered Iraqi diplomatic isolation. The Soviets were alarmed by the Iraqi actions as they saw it as playing into the hands of the Iranian Islamist factions at the expense of Tudeh, the Iranian Communist Party. Saddam's rivalry with Syria, clamping down on the ICP and rhetoric about pan-Arabism had already soured Iraqi-Soviet relations, especially since Iraq had publicly critiqued the Soviet Afghan invasion. The Soviets declared an embargo on Iraqi arms and refused to honor existing contracts, which became a major issue as the Iraqi offensive stalled and ate up existing stocks of munitions and equipment.