Why was there economic disaster under President Carter and economic prosperity under President Reagan?
It is very hard to know the answer to this question. Economists are not able to determine with certainty why the economy acts as it does. We can speculate that some mix of the following factors caused the difference (which your question exaggerates to some degree) between the Carter and Reagan years.
The energy crisis and the OPEC embargo. The American economy runs on oil. When the supply of oil is interrupted, the economy suffers. The US economy suffered from two major interruptions during this time. In 1973, OPEC placed an embargo on oil because of US support for Israel. This led to a major disruption in the American economy. This, we can argue, was still hurting the US during the Carter years. In 1979, another oil shock occurred because of the Iranian Revolution. Oil prices jumped significantly and the economy was hurt once again.
Watergate. Watergate did not directly affect the US economy but it (and the Vietnam War) led to a general lack of confidence in the United States. When people are not confident in their country’s direction, they tend to spend less. Businesses are less likely to expand. Overall, the economy tends to suffer.
Carter’s lack and Reagan’s abundance of charisma. If the American people lacked confidence, President Carter did very little to help them regain their confidence. Carter did not inspire hope. Instead, he seemed to send a message that the US was slumping and that people should adjust their expectations. By contrast, Reagan sent the message that America was still great and people should still be confident. This is similar to the difference between Presidents Hoover and Roosevelt during the Great Depression. Carter made people worry while Reagan helped give them confidence.
Deficit spending. Reagan cut taxes without cutting spending. He increased military spending and was unable to decrease domestic spending. This meant that the government was stimulating the economy. It was giving more people jobs (through its spending) and was taking less money away from them in taxes.
Deregulation. This started under Carter and continued under Reagan. The government stopped imposing so many rules on business. This allowed businesses to become more profitable.
All of these factors played at least some role in the differences in the economy between the Carter years and the Reagan years.