But President Eisenhower was afraid that a US military industrial complex that was already spending astronomical amounts of money on Earth-- would do the same in space. So creating a peaceful civilian space program was Eisenhower's attempt to curtail massive expenditures on space travel by the US military.
But people forget that during John Kennedy's administration, the US was still well behind the Soviet Union in space achievements and in space technology. The Soviets placed the first human being in orbit soon after Kennedy came into office, further demonstrating their growing technological and political superiority over the United States and the non-communist world. Afterwards, the Soviet Union paraded Yuri Gagarin around the world as an international super star, a political ambassador for the wonders of communism!
Kennedy's reason for entertaining the idea of cooperating with the Soviet Union in space was because no one really knew what the manned Soviet goals in space really were. Would the Soviets claim the Moon and eventually the rest of the Solar System as part of the growing Soviet communist empire? And with the US so far behind in space technology, could the US even stop them from doing so!
Kennedy was told that America was so far behind the Soviet Union in space technology that they would have to spend massive amounts of money on space if the US was to avoid Soviet domination of the new frontiers of space. So that's why he did it! That's why Kennedy used the Moon as a way of leaping ahead of Soviet efforts in space-- just a week after the Soviets humiliated the US again by placing the first human into orbit around the Earth.
International communism and Soviet influence at that time was threatening the United States in practically every region of the planet. We were still in the middle of the Cold War-- and it wasn't a joke! Just a year after Kennedy came into office, the Cuban missile crisis between the US and the Soviet Union almost started World War III and a possible thermonuclear war.
However, the race between the US and Soviet Union in space ended during the Johnson administration when both the US and the Soviet Union signed the Outer Space Treaty in 1967. The law forbid any country from placing weapons of mass destruction on the lunar surface or on any other celestial body and also made it illegal for any single country to own the Moon or any other celestial body in space. So the US fear of a militarized communist Moon was finally over and so were the reasons for a space race between the US and the Soviet Union.
Marcel F. Williams