In order to (arguably) protect its supply of oil and prevent the rule of a pro-Soviet nationalistic government in Iran, the United States supported actions that led to the overthrow of Prime Minister Mohammad Mosaddegh and the installation of the pro-Western shah as ruler of Iran.
The events that this question refers to happened in 1953. This was during the Cold War, which was a worldwide conflict between the United States and the Soviet Union. The US was a democratic and capitalist country and the Soviet Union was a communist country. Both countries wanted to spread their systems around the world and prevent the spread of their rival’s system. They took various actions to try to achieve these aims.
The US believed that Mosaddegh’s government was dominated by communists. They feared that an Iran that was run by Mosaddegh would favor the Soviets, giving the USSR a great deal of power in a very strategically important part of the world. Therefore, the US financed large protests against Mosaddegh and the Iranian army took power, ostensibly to maintain order. Mosaddegh was arrested and convicted of treason. The shah was put in power and ruled Iran autocratically until 1979. These events helped create the bad relations that exist today between the US and Iran.