It's often cited as one of the great ironies of history - that the United States and the Soviet Union were allies during World War II, and then enemies during the Cold War. Why is this?
We were fighting against a greater enemy during World War II, which was Nazi Germany
The answer is long and a bit complicated, but essentially it boils down to this: We in America allied with Soviet Russia during World War II to fight against a greater enemy (Nazi Germany) that had actually declared war on us, when Soviet Russia had not. Later on, we watched with horror as the poor countries of Eastern Europe were passed from one dictator (Hitler) to another (Joseph Stalin), and reluctantly realized that the Soviet Union could be every bit as threatening as Nazi Germany had been; and fought hard to prevent its expansion into any further territory.
The common theme in our dealings with the Russians was America's national interest
These ideas might seem incompatible: Allying with the Russians during one five-year period, and being enemies with them for more than forty years after that. Yet the alliance and the later conflict both had a common theme in them, which was America's national interest. It was served by an alliance of necessity during World War II, and an opposition of equal necessity during the Cold War period.
Russian Revolution of 1917