The National Aeronautics and Space Administration (NASA) was created in 1958 as an agency charged with overseeing all non-military aerospace programs. Previously, the National Advisory Committee for Aeronautics (NACA) handled rocket research and other aerospace activities, but the Soviet launch of Sputnik made it apparent that the United States needed to focus its efforts in order to avoid being left behind in the space race. One of NASA's first goals was putting a man into space.
NASA absorbed its predecessor NACA, as well as aerospace departments of some military organizations. Of particular note was the Army Ballistic Missile Agency, where Wernher von Braun was working on rocket designs capable of carrying large payloads into space. His expertise would be instrumental to the fledgling aerospace organization. Bringing these organizations into a single department helped reduce inefficiencies and the duplication of efforts, allowing the brightest aerospace minds in the country to work together instead of competing. NASA began by taking over unmanned programs that had begun in these other groups before moving on to the more audacious task of sending up a human astronaut with Project Mercury.
While NASA formed as a civilian organization, it maintained close ties with the military. Many of the original astronauts were military test pilots, familiar with the risks involved in piloting experimental vehicles and pushing the envelope in terms of their capabilities.