The United States and the USSR each want to achieve technological superiority over the other. Part of this conflict was the race to become the first country to build a rocket that could launch into space. This was not only important because it proved what was possible, but it also meant that if a rocket was powerful enough to take a payload into space, then it could easily carry a nuclear warhead.
In October 1957, the USSR launched their Sputnik program, which was the world's first artificial satellite. The USSR then put Sputnik 2 into orbit before the US was able to put its first. Then they began to aim for the moon...
Source: The Space Race: Timeline, Cold War & Facts - History. https://www.history.com/topics/cold-war/space-race.