President Kennedy was trying to renew America's "place" and prestige in the world.
The Soviets, had gained much power, prestige, and influence in the world’s view. The USA needed to be shook up. There were a lot of problems here, and a lot of reluctance on the part of many to do anything about them. Some of the more noteworthy problems were:
Poverty, equal rights for Blacks, and Women. Education, especially in the sciences, needed an overhaul. With the space for outer-space, Kennedy gave people a visibly track able, hi-tech, and imaginative mission that people could watch on TV and feel a part of. He knew that the space race would yield many technical spin-offs.