Gerard Degroot argues in "The Dark Side of the Moon" [1] that going to the moon was mostly about (1) allowing Democrats (LBJ and JFK) to score political points by criticising the Eisenhower administration and (2) cashing in on American cultural enthusiasm for space (Buck Rogers, Orson Welles, etc.). Space exploration didn't actually make much sense in terms of defense policy, international relations, or scientific research.
Eisenhower hated the idea of throwing money away on expensive programs that offered poor return on investment and were primarily funded for political reasons (his famous comments about the military industrial complex were made in a speech at the very end of his presidency). He funded development of American ICBM and space reconnaissance programs in the late 50s, but did so separately from space exploration programs. By the time of the Mercury missions we already had mature ICBM and satellite programs and it didn't have much to do with real defense needs.
Even in the late 50s the US was never really behind the USSR in terms of space technology, but for strategic reasons it was sometimes unclear how far ahead the US was (for example, we had extensive photographs from satellites showing Russian nuclear missile launch sites; these indicated that we had far more missiles than the Russians, but at the time the satellites used to collect these photos were still secret, and so the intelligence they revealed was not widely known, even though most Americans believed at the time that America lagged behind the Russians).
Sputnik may have been the first satellite in space, but Eisenhower had intentionally stopped von Braun from launching a satellite even though we were very close to having that capability. Eisenhower was mostly concerned with establishing a precedent that would allow satellites to fly over foreign countries, and didn't mind if the Russians were the first to space if this meant that one of their satellites would establish this precedent instead of one of ours.
Eisenhower hated the idea of throwing money away on expensive programs that offered poor return on investment and were primarily funded for political reasons (his famous comments about the military industrial complex were made in a speech at the very end of his presidency). He funded development of American ICBM and space reconnaissance programs in the late 50s, but did so separately from space exploration programs. By the time of the Mercury missions we already had mature ICBM and satellite programs and it didn't have much to do with real defense needs.
Even in the late 50s the US was never really behind the USSR in terms of space technology, but for strategic reasons it was sometimes unclear how far ahead the US was (for example, we had extensive photographs from satellites showing Russian nuclear missile launch sites; these indicated that we had far more missiles than the Russians, but at the time the satellites used to collect these photos were still secret, and so the intelligence they revealed was not widely known, even though most Americans believed at the time that America lagged behind the Russians).
Sputnik may have been the first satellite in space, but Eisenhower had intentionally stopped von Braun from launching a satellite even though we were very close to having that capability. Eisenhower was mostly concerned with establishing a precedent that would allow satellites to fly over foreign countries, and didn't mind if the Russians were the first to space if this meant that one of their satellites would establish this precedent instead of one of ours.
(1) https://www.amazon.com/dp/0814719953