Customers in the branch of the Swedish fashion retail chain called the police around 12:30 pm after the man had held up the store near the city's Marktplatz.
A few hostages were able to flee. "They were completely distraught, upset and crying," said police spokeswoman Anke Fittkau.
She could not say what kind of weapon the man had, but witnesses at the scene said he was carrying a pistol.
The authorities surrounded the shop and evacuated nearby buildings, affecting some 70 stores. Members of the state police made contact with the 41-year-old man, who then quickly surrendered.
He told police that "medical reasons" had driven him to take the hostages.
Hendrik Alpen, a spokesman for H&M, said it was still unclear why he had singled out the popular retail chain.
“We're in contact with our employees and the regional managers, who happened to be at the location today,” he said. “We've sent psychological counsellors there and we're doing all we can to support our customers and employees while working with the police.”