The attack had been motivated by “hate’, mayor Olaf Scholz said, although he stopped short of declaring it a terrorist incident.
“It makes me especially angry that the perpetrator appears to be a person who claimed protection in Germany and then turned his hate against us,” he said.
If confirmed as an Islamist attack, it would be the first in Germany since Tunisian Anis Amri drove a truck into crowds at a Berlin Christmas market on December 19 last year, killing 12 and injuring 48.
Police said that the man was a 26-year-old born in the United Arab Emirates, but were unable to immediately confirm his nationality or identify the motive behind the violence.
News website Spiegel Online reported that the individual was named Ahmad A., who had arrived in Germany seeking asylum and had contact with the Islamist scene as well as a history of mental health problems and drug use.
The attacker had been scheduled to be deported, but the process had been held up as he lacked identity papers, Scholz said.
A police murder unit and a squad specialising in politically-motivated crime are investigating the attack.
Germany has been on high alert about the threat of a jihadist attack since Amri’s rampage in Berlin, for which the Islamic State group claimed responsibility.
Jihadists have also carried out a string of random assaults in European countries using knives.
Like the Hamburg attacker, Amri was a failed asylum seeker who could not be deported for lack of documents.
The similarity between the two cases risks reopening barely-healed wounds over Chancellor Angela Merkel’s decision to allow more than million migrants into Germany since 2015, with just two months to go until legislative elections in September.
“These criminals want to poison our free society with fear, but they will not succeed,” Mayor Scholz said.
The attacker stabbed to death a 50-year-old man, believed to be a German citizen, and “struck out wildly” at others, wounding a woman and four men aged 19 to 64, police said.
Another 35-year-old man was hurt while overpowering the attacker in the street alongside other passers-by shortly after the killing.
“A crowd of about 30 people ran out of the supermarket. They yelled that someone had been stabbed... we saw a man go past with a big knife, like a butcher’s knife, in his hand,” eyewitness Ralf Woyna said.
Woyna had been sitting at a cafe opposite the entrance to the shop where the chase began.
“Two customers who also looked Middle Eastern took all the chairs from the cafe and ran after him. I lost sight of them for a minute and heard a shout of ‘Allahu Akbar’ in the distance, I knew it was an attack straight away,” he added.
An amateur mobile phone video published by news site Spiegel Online showed a handful of pursuers confronting the attacker, a bearded man wearing a T-shirt and jeans, amid dense city traffic.
They can be seen hurling chairs at him to keep him at a safe distance as he yells and brandishes the knife.
According to Spiegel Online, the 35-year-old man injured during the struggle was the one who finally forced the suspect to the ground, using a pole.
The witnesses slightly hurt the attacker while they were overpowering him, before handing him over to police.
Newspaper Bild published images of the man lying handcuffed on the ground and sitting in the back seat of a police car, a bloodied white bag pulled over his head.