Jason Armstrong, 29, told officers the gang ordered him into the station to test the security there, police said.
Officers smelled marijuana on him and noticed him acting strangely, so they approached him, Police Commissioner Anthony W. Batts said.
The Black Guerilla Family is a gang with ties to violence and drug trafficking in the Baltimore area, police said.
Officers searched Armstrong and found the handgun, with a round loaded in the chamber. The man also had cocaine and marijuana, Batts said.
"We are really lucky, for a person walking into a police station fully armed and loaded with guns on him, that it did not end up in a terrible situation," said Batts.
Police charged Armstrong with various weapons and narcotics violations.
"An organized gang in the city of Baltimore sent an armed suspect into our building to see our security, to test our security. That is alarming to us," Batts said. "In light of other incidents that have occurred in other cities, it has raised our level of concern."
Batts said he is calling a meeting with federal agencies including the FBI, Bureau of Alcohol, Tobacco, Firearms and Explosives, and the Drug Enforcement Administration and has already sent an alert to other law enforcement agencies.
"We're not going to cower, we're not going to back down, we're not going to shy away from tough situations," he said. "We are going to be a Constitutional police department while we keep this city safe and continue to patrol the streets of the City of Baltimore."
Deputy Commissioner Jerry Rodriquez said, "This person did not go in there on his own free will. This person had very little option, according to his statement, which lends credibility to what a dire situation this was."
FBI spokesperson Minique Crump said the bureau is in communication with Baltimore police, but at this point it is a local matter being handled by Baltimore.
Crump said the case is not related to a joint FBI-DHS bulletin sent in October warning law enforcement agencies across the country about potential attacks against police officers. The bulletin was sent after intelligence officials picked up chatter from ISIS members urging attacks against government officials, including law enforcement and military personnel.