The United States provided dual support only in a limited sense. The other user who commented, while correct that US support was overwhelmingly greater as far as we can tell to Iraq, also messes up a few details (such as the extent of US sales to Iran, which consisted of multiple missile transactions for TOWs and HAWK missiles). The US aid to Iraq was geopolitically motivated. The belief was that the Iraqi win would provide the US with a better strategic position than vice-versa. One has to recall the level of unfriendliness between the Reagan administration and the Iranian Revolutionary government, after all.
Even so, the US did not really get involved right away on the Iraqi side. The goal of the US was not necessarily to help Iraq alone, at least not at first. We can only guess at strategy using the information available, since many strategy documents remain classified, but some of the indications we have suggest that US support was mostly a reaction to the likelihood, in 1982, of an Iranian victory. The fear became that Iran's victory would prove disastrous to other states in the region, and therefore that Iraq was now the bulwark against Iranian abilities to spread their revolution to nearby states.
The US aims with regards to Iran were far more limited. The aid to Iran largely consisted of a series of shipments of missiles, provided in 1985-86, which were sold through Israel and passed through intermediaries. These weapons were meant to secure the release of US citizens being held hostage by Iranian-affiliated groups like Hezbollah. Hostages were being held in Beiruit, including a CIA station chief, and the arms shipments were largely based around an agreement to release those hostages once the shipments were made. The US did have a second interest, that of renewed relations with Iran, but this was lower-ranking in the level of priorities, and related more to the US government's geopolitical jockeying back and forth between the two parties at war. The US was concerned that Iran's shift towards Soviet alignment would become very pronounced, and also feared (as the Tower Commission Report noted) that in the event that Khomeini died, the Soviets would interfere with the succession process. The arms shipments were thus meant to be part of a "strategic opening to Iran", to quote the report.
Israel's support was a function of Israeli interests in the region. Throughout its history, Israel had relied heavily on alliances in the "periphery", a strategy that looked at alliances with Iran (pre-Revolution), Turkey, and similarly positioned states that were around the Arab Middle Eastern states as a counterbalance to the Arab world. This "periphery" strategy is worth a post all its own, but Iran had been a strong ally of Israel until the Revolution, and during the Iran-Iraq War, Israel reached out to both Iran and Iraq in search of allies. Israel was quickly rebuffed by Iraq, but Iran proved willing to accept Israeli assistance, and so Israel provided, hoping the alliance would prove fruitful. As history subsequently showed, the hope was misplaced: using Israel as a propaganda point with which to gain support in the "Arab street" was more important to Iranian leaders than a potential alliance with Israel, which was too unpopular with the Muslim world at large.
China and the Soviet Union's support for both sides has its own roots in geopolitical posturing. The Soviet Union, for example, had been largely rebuffed by the Iranian government, and therefore reached out to Iraq for an inroads into the region. They, like the US, feared an Iranian victory would destabilize the region and amplify Iranian power. At the same time, they were willing to provide some arms shipments to Iran, for the same reason the US was: they knew it was geopolitically important, likely to be a powerful state, and wanted their "in" there as well. They also benefited from the arms exports in general.
China was, during the war, one of the biggest suppliers of weapons to Iran. A CIA estimate suggested that they were in fact Iran's biggest supplier as of 1986, providing billions of dollars in weaponry and also training some Iranian officers. At the same time, China was one of the largest arms exporters to Iraq. Why were they helping both sides? Unlike the Soviet Union and US, their interests appear to have been less geopolitical, and more simple: the money was good, and the ability to help both sides was seen as a geopolitical win-win. They were one of the most effective states diplomatically, some argue, because their ability to play both sides left them with significant inroads and netted them hefty sums of money.
North Korea was a provider of arms primarily to Iran because of the money as well, and because of their position as a communist state willing to act as a go-between for Soviet and Chinese interests in the area.
Canada and Sudan, I unfortunately have to plead ignorance on.
Please let me know if you'd like recommendations for further reading on the motivations, or clarification on any point!