After World War II, the United States was by far the strongest and richest country in the world. The Soviet Union emerged from the war more battered than the US, but stronger than any other country. These two facts affected American foreign policy after the war.
With the US as the strongest and richest country in the world, it became the undisputed leader of the free world. The strength of the Soviet Union, and its opposition to the US on ideological grounds) meant that the two countries would dominate the international scene. These combined to mean that American foreign policy had to concern itself with events in all parts of the world so that it could contain communism. This situation was the legacy of WWII.