The cold war was on one hand, between the United States, Europe, and the Western Bloc of Germany and on the other hand the Soviet Union and the eastern bloc of Germany. It wasn't a direct fight, and it lasted from 1947 to 1991 when the Berlin wall collapsed. This cold war in some ways laid foundation for man's first landing on the moon.
On April 12th, 1961, Soviet's cosmonaut Yuri Gagarin became the first man in space when he orbited the earth in 89 minutes, He was aboard his space capsule, Vostok 1. To America, this advancement by the Soviet Union was a source of huge concern. Not only did it stab America's pride that its greatest rival had reached space first, it was worrisome then that the Soviet Union would soon begin to shift nuclear weapons into space. America was so enraged that President J.F. Kennedy banned Yuri Gagarin from visiting America after he became an instant celebrity following his return from space.
In 1962, JFK founded NASA with a major aspiration to put man in space before the end of that decade. It was a greater challenge which would surpass the Soviet's achievement of putting the first man in space, and thereby bringing pride back to the United States in the face of the cold war. So in the unfolding years, America dedicated so much investment - human and capital - towards achieving this aim. It worked towards the end of that decade.
On 20th July, 1969, Apollo 11 - The Eagle - landed the first men on the moon surface. Neil Armstrong - the three-man crew commandant - was the first to land, declaring famously, "One small step for a man, one giant leap for mankind." Nineteen minutes later, Lunar Module Pilot, Buzz Aldrin stepped his foot on the moon becoming the second man in that regard. The third crew member, Micheal Collins, who was the Command Module Pilot, didn't land on the moon surface, rather he was hovering around the moon atmosphere.
Through this, a giant leap was made by mankind, and it was because of the cold war.