Kennedy deserves credit for the space race, while Johnson deserves credit as the engine of the space race.
Eisenhower was absolutely apathetic to space. He did not care. He'd have rather avoided it, and it didn't much matter to him if a man ever went to the moon. Let the Soviets have it. But pressure was such that he founded NASA, which in those days had the basic plan of Mercury in the 60s, a vague idea about a space station maybe somewhere, and a moon mission circa I think 1975. And not even necessarily a landing -- potentially just circumlunar travel. Apollo (or what that stood for in those days) was a vague far off thing. And in terms of politics, what that plan and all it's long term ideas meant was that you weren't gonna see half of it in the real world. That would concern me about Nixon winning in 1960: a weaker space program.
Kennedy would also have rather focused on earth than space, but he did genuinely take up the baton of a space race because he believed it was necessary. And it was necessary either to show supremacy over the Soviets, because the United States was being embarrassed by their space achievements and could not claim superior science with that example. Or it was to cooperate with the Soviets to usher in detente. Either/Or. Johnson was the driving force for a moon landing rather than something like a space station. There's other factors too, and other individuals, but that's the matter in simplest terms. NASA would have probably preferred a space station and then a moon landing, because asking us to go from monkeys into suborbit to landing on another world in a decade was insane if you were closer to the monkey-into-suborbit era of that timeline. But Kennedy was not in it for that. He wanted the moon, and would get the moon, or there wouldn't be any reason to go to the moon at any point for him.
That said, the problem with the US-Soviet Joint Lunar Mission is that Kennedy did propose it, but Congress would not have allowed it. Congress passed legislation in response to that speech that if NASA cooperated with the Russians in any way, it's funding would be cut.