Aaron Alexis, 34, of Fort Worth, Texas, a onetime Navy contractor who attended a Buddhist temple and had two gun-related brushes with the law.
He received a general discharge from the US Navy Reserve in 2011 after a series of misconduct issues, a Navy official said.
READ: 'Cowardly act' at Navy Yard kills patriots: Obama
He was killed in one of several gun battles with police. The motive - and how he breached security - remained unknown. About 12 people were injured, Washington Mayor Vincent Gray said, though it was unclear how many of them were shot.
Hours after the incident, police were searching for a possible second suspect in an incident that raised questions about security at the Washington Navy Yard, about a mile (1.6km) south of the US Capitol and 3 miles (5km) from the White House.
Somehow the gunman managed to enter the US Naval Sea Systems Command Headquarters building about 8:20am (1220 GMT) and started picking off victims from a fourth-floor atrium, witnesses said.
That set off pandemonium, with fire alarms sounding and security officers yelling at people to leave the building. Hundreds fled, some scrambling over walls to escape the gunfire. A loudspeaker announcement ordered those who remained to stay in their offices.
The command where the shooting takes place requires two separate identification badges, one to get on the base and another to access the building, according to a source who works at the Navy Yard and requested anonymity.
District of Columbia Police Chief Cathy Lanier briefs reporters on the shooting at the Washington Navy Yard in Washington. (AP Photo)
Police patrol officers and active shooter teams responding to calls fought a series of gun battles with the shooter until he was killed, Washington Metropolitan Police Chief Cathy Lanier said.
"Everybody was panicking and trying to decide which way to get out. A few of us just ran out the side exit," Patricia Ward, who works at the Navy Yard, told reporters. Security guards told people to "run, run, run," Ward said.
READ: Obama getting updates on Navy Yard shooting
It was the worst attack at a US military installation since US Army Major Nidal Hasan opened fire on unarmed soldiers at Fort Hood, Texas, in 2009, killing 13 people and wounding 31 others.
Hasan, who said he acted in retaliation for US wars in Muslim countries, was convicted and sentenced to death by a military jury in August.
"We are confronting yet another mass shooting, and today it happened at another military installation, in our nation's capital," said US President Barack Obama, who vowed to enact "sensible" gun control measures after a gunman shot dead 20 school children and six adults at an elementary school in Connecticut in December 2012.
Law enforcement officers respond to the scene of a shooting at the Washington Navy Yard in Washington. (Reuters Photo)
Interest in Buddhism, Thailand
Alexis, a one-time Texas resident who was known to worship at a Buddhist temple, served in the military and most recently was furthering his education while holding a job in the private sector, his father, Algernon Alexis, told Reuters in a telephone interview.
"This comes as a complete shock," the elder Alexis said when told his son was the suspected shooter.
Image released by the FBI shows a photo of Aaron Alexis, who police believe was a gunman at the Washington Navy Yard shooting in Washington. (AP Photo)
Alexis served full time in the US Navy's Reserve from May 2007 to January 2011, reaching the rank of Aviation Electrician's Mate 3rd Class, and received the National Defense Service Medal and the Global War on Terrorism Service Medal, a Navy official told Reuters.
He had been a civilian information technology contractor for the Navy, though it was unclear whether Alexis was working at the Washington Navy Yard in a civilian capacity at the time of the incident, officials said.
He was arrested on September 4, 2010, in Fort Worth, Texas, on a misdemeanor charge of discharge of a firearm but the case was dropped when investigators determined that Alexis was cleaning his gun and it accidentally fired, Tarrant County prosecutors, said in a statement.
READ: Hospital says three victims in critical condition
Alexis was also arrested in Seattle in 2004 for shooting out a construction worker's car tires in an anger-fueled "blackout" triggered by perceived "disrespect," according to the Seattle Police Department.
Alexis told detectives "he was present during the tragic events of September 11th, 2001, and how those events had disturbed him," according to a police report.
Alexis worked at the "Happy Bowl" restaurant in Fort Worth, Texas, in 2008, said Tiki Confer, 64, the owner of the Bangkok House Thai restaurant in White Settlement, Texas. She said he spoke Thai and worshipped at a Buddhist temple.
"He was a very nice boy. When I saw his picture on the news, I was shocked," Confer told Reuters.
The shooting rattled the US capital, forcing the Federal Aviation Administration to briefly suspend departures at Reagan National Airport. The District of Columbia Public Schools put six schools and an administration building on lockdown as a precaution.
The Washington Nationals baseball team postponed their game against the Atlanta Braves scheduled for Monday night at nearby Nationals Park.
Agents sealed off the area in front of the White House when a man threw firecrackers over its north fence line. Navy Secretary Ray Mabus called the Navy Yard shootings "an attack on the Navy family."
The shooting revealed a potentially serious security breach. Military personnel are generally banned from carrying weapons on military installations but most people with proper credentials are not routinely checked for firearms.
"It will be interesting to see as this develops who the shooter is, how he got in," said Navy Commander Tim Jirus, who was in charge of evacuating the Sea Command building.
"Right now a lot of people are wondering just how safe the building is or just how safe the office environment is."