As with most of the world's problems, the U.S. government's problems with Iran are the consequence of obsessive anti-communism, They were so afraid that Iran was going to turn communist that they installed the Shah in 1953, but then he was overthrown in 1979 and suddenly we had a regime in that country which virulently hated the United States.
Nevertheless, Reagan still liked them, as they helped him get elected President. Reagan was also obsessively anti-communist that he was all too willing to jump into bed with the Islamic Republic in order to punish our Latin American neighbor for defying U.S. hegemony. So, as I see it, Iran willingly joined the game and supported Ronald Reagan. America's short-lived peaceful turn in the brief period between the end of the Vietnam War and Reagan's election in 1980 apparently did not suit Iran, so they worked on ruining Carter's presidency in favor of Reagan, who was much more of a warmonger than Carter, and who then proceeded to ramp up the Cold War and U.S. military aggression worldwide.