On that basis the military was advocating for a moon mission years before Kennedy's speech. It's hard to tell if this actually played a big role in the decision to go to the moon, but it was the cold war after all.
Also the Soviet Union was winning most of the relevant milestones in space (first satellite, first animal in orbit, first human, first woman, first space walk, etc), and this was a great source of national pride. Beating them had great propaganda value.