The Cold War was fought directly after WWII between the Soviets and the US. Although they didn’t actually launch attacks on each other, they were indirect. Both were allies during World war two though. That was when they both began getting feelings of distrust towards each other.
During World War Two, the Soviets were fighting to defend Stalingrad and asked America for help. We had a very weak and delayed response. The Soviets became bitter towards us for that reason. We simply just didn't want to help the Soviets because we didn't support their communist government. This would come back to bite us later though. The Soviets end up doing the same to us when we ask them for help. This left a lot of tension between these two countries.
Another reason the soviets didn't trust the US was because we had figured out the Atomic bomb but we wouldn't share it with anyone. We declared it to dangerous so no one was allowed to use it besides the US basically. This upset a lot of countries. But by the end of the WWII and the beginning of the Cold War the Soviets completer successful atomic bomb tests. Now the playing field was even. But both countries understood the consequences of using the atomic bomb. There would be mass retaliation and mass destruction. So we didn't engage in a hot war.
The US had a big problem with communism. It went against our basic nationalists ideas. We believed in independence and freedom. We wanted other countries to experience this too. So we decided containment was the best option. We attempted to contain the spread of communist nations in Europe. So we fought behind other countries trying to resist the soviets and communism. We offered troops and financial help to any country trying to resist.
So in conclusion, this war was built up by years of distrust and tension. The Unites States fear of communist attack, fear of the spread of communism in Eastern Europe, lack of respect of Stalin, and our refusal to share our nuclear secrets all played a huge role in the war. The Soviets fear of American attack with nuclear weapons, their dislike of capitalism, their actions in Germany after the War, their expansion into Eastern Europe and broken election promises all played a huge role in the Cold War as well.