Glenn remained an officer in the Marine Corps after his selection, and was assigned to the NASA Space Task Group at Langley Research Center in Hampton, Virginia. The task force moved to Houston, Texas, in 1962, and became part of the NASA Manned Spacecraft Center. A portion of the astronauts' training was in the classroom, where they learned space science. The group also received hands-on training, which included scuba diving and work in simulators. Astronauts secured an additional role in the spaceflight program: to provide pilot input in design. The astronauts divided the various tasks between them. Glenn's specialization was cockpit layout design and control functioning for the Mercury and early Apollo programs. He pressed the other astronauts to set a moral example, living up to the squeaky-clean image of them that had been portrayed by Life magazine, a position that was not popular with the other astronauts.
Glenn was the backup pilot for Shepard and Grissom on the first two crewed Project Mercury flights, the sub-orbital missions Mercury-Redstone 3 and Mercury-Redstone 4. Glenn was selected for Mercury-Atlas 6, NASA's first crewed orbital flight, with Carpenter as his backup. Putting a man in orbit would achieve one of Project Mercury's most important goals. Shepard and Grissom had named their spacecraft Freedom 7 and Liberty Bell 7. The numeral 7 had originally been the production number of Shepard's spacecraft, but had come to represent the Mercury 7. Glenn named his spacecraft, number 13, Friendship 7, and had the name hand-painted on the side like the one on his F-86 had been. Glenn and Carpenter completed their training for the mission in January 1962, but postponement of the launch allowed them to continue rehearsing. Glenn spent 25 hours and 25 minutes in the spacecraft performing hangar and altitude tests, and 59 hours and 45 minutes in the simulator. He flew 70 simulated missions and reacted to 189 simulated system failures.
After a long series of delays, Friendship 7 lifted off from Cape Canaveral Air Force Station on February 20, 1962. There were eleven delays during the countdown due to equipment malfunctions and improvements and the weather. During Glenn's first orbit, a failure of the automatic-control system was detected. This forced Glenn to operate in manual mode for the second and third orbits, and for re-entry. Later in the flight, telemetry indicated that the heat shield had loosened. If this reading had been accurate, Glenn and his spacecraft would have burned up on re-entry. After a lengthy discussion on how to deal with this problem, ground controllers decided that leaving the retrorocket pack in place might help keep the loose heat shield in place. They relayed these instructions to Glenn, but did not tell him the heat shield was possibly loose; although confused at this order, he complied. The retrorocket pack broke up into large chunks of flaming debris that flew past the window of his capsule during re-entry; Glenn thought this might have been the heat shield. He told an interviewer, "Fortunately it was the rocket pack—or I wouldn't be answering these questions." After the flight, it was determined that the heat shield was not loose; the sensor was faulty.
As the first American in orbit, Glenn became a national hero, met President John F. Kennedy, and received a ticker-tape parade in New York reminiscent of those honoring Charles Lindbergh and other heroes. He became "so valuable to the nation as an iconic figure", according to NASA administrator Charles Bolden, that Kennedy would not "risk putting him back in space again." Glenn's fame and political potential were noted by the Kennedys, and he became a friend of the Kennedy family. On February 23, 1962, President Kennedy gave him the NASA Distinguished Service Medal for his Friendship 7 flight. Upon receiving the award, Glenn said, "I would like to consider I was a figurehead for this whole big, tremendous effort, and I am very proud of the medal I have on my lapel." Glenn also received his sixth Distinguished Flying Cross for his efforts. He was among the first group of astronauts to be awarded the Congressional Space Medal of Honor. The award was presented to him by President Jimmy Carter in 1978. After his 1962 spaceflight, NASA proposed giving Glenn the Medal of Honor, but Glenn did not think that would be appropriate. His military and space awards were stolen from his home in 1978, and he remarked that he would keep this medal in a safe.
In 1962, NASA contemplated recruiting women to the astronaut corps, but Glenn gave a speech before the House Space Committee detailing his opposition to sending women into space, in which he said:
At 42, Glenn was the oldest member of the astronaut corps and would likely be close to 50 by the time the lunar landings took place. During Glenn's training, NASA psychologists determined that he was the astronaut best suited for public life. Attorney General Robert F. Kennedy suggested to Glenn and his wife in December 1962 that he run for the 1964 United States Senate election in Ohio, challenging aging incumbent Stephen M. Young (1889–1984) in the Democratic primary election. As it seemed unlikely that he would be selected for Project Apollo missions, he resigned from NASA on January 16, 1964, and announced his Democratic Party candidacy for the U.S. Senate from his home state of Ohio the following day, becoming the first astronaut-politician. Glenn was still a Marine, and had plenty of unused leave time. He elected to use it while he waited for his retirement papers to go through.
The Glenn Research Center at Lewis Field in Cleveland is named after him, and the Senator John Glenn Highway runs along a stretch of I-480 in Ohio across from the Glenn Research Center. Colonel Glenn Highway (which passes Wright-Patterson Air Force Base and Wright State University near Dayton, Ohio), John Glenn High School in his hometown of New Concord, and the former Col. John Glenn Elementary in Seven Hills, Ohio, were also named for him. Colonel Glenn Road in Little Rock, Arkansas, was named for him in 1962. High schools in Westland and Bay City, Michigan; Walkerton, Indiana; San Angelo, Texas, and Norwalk, California bear Glenn's name. The fireboat John H. Glenn Jr., operated by the District of Columbia Fire and Emergency Medical Services Department and protecting sections of the Potomac and Anacostia Rivers which run through Washington, D.C., was named for him, as was USNS John Glenn (T-MLP-2), a mobile landing platform delivered to the U.S. Navy on March 12, 2014. In June 2016, the Port Columbus International Airport in Columbus, Ohio, was renamed John Glenn Columbus International Airport. Glenn and his family attended the ceremony, during which he spoke about how visiting the airport as a child had kindled his interest in flying. On September 12, 2016, Blue Origin announced the New Glenn, a rocket. Orbital ATK named the Cygnus space capsule used in the NASA CRS OA-7 mission to the international space station "S.S. John Glenn" in his honor. The mission successfully lifted off on April 16, 2017.