“Special response units overpowered the man. During the police action he hurt two bystanders, one of them seriously,” police said in a statement.
The attacker had to be resuscitated and was in intensive care for “extremely serious” injuries sustained when officers stormed the shop, they added.
“The motive of the attacker remains unclear,” a spokesman said soon after he was subdued.
A woman held hostage by the perpetrator was only “lightly wounded”, police tweeted shortly after she was freed around 3:00 pm (1300 GMT).
But another victim, a 14-year-old girl, was brought to hospital suffering from burns.
Eyewitnesses said the teenager had been in a cafe close to the pharmacy immediately before the hostage-taking.
Police set up a webpage where members of the public could upload pictures and video related to the incident, while their own investigations were “at full pitch”.
They began receiving calls about the violence around lunchtime.
An eyewitness told journalists how she heard screams and saw “a girl running for her life” from the cafe with flames spreading up her leg, before she was helped by bystanders.
First responders arrived around 12:45 pm at the central station directly next to Cologne’s twin-spired cathedral, locking the whole building down.
As members of the public were ordered to leave the area as quickly as possible, state rail operator Deutsche Bahn shut down the busy main train station in Cologne — a major hub for rail travel through North Rhine-Westphalia state and nationwide.
Officers initially said they were in contact with the hostage-taker to determine his demands and whether he was armed.
But shortly afterwards police commandos stormed the pharmacy with stun grenades.
“The perpetrator is under control. Police measures are continuing,” Cologne police wrote on Twitter just after the special unit assaulted the shop.