The 27-year-old had intended to target a nearby music festival in the city of Ansbach, news agency DPA quoted regional interior minister Joachim Herrmann saying.
The attacker, who lived in the city after arriving in Germany two years earlier, had tried to enter the festival but was turned away as he did not have a ticket.
The explosion happened just outside a bar in the city centre, not far from where some 2,500 people gathered for the concert, at around 10pm.
Police blocked off the area and emergency services were at the scene. Bomb experts were also sent to determine the cause of the blast.
“An explosion went off in the city centre and a man, which the latest enquiries show caused it, was killed,” police said in a statement. A dozen people were wounded, three of them seriously, added a spokeswoman.
Ansbach deputy police chief Roman Fertinger said there were “indications” that pieces of metal had been added to the explosive device. Herrmann said the attacker, whose asylum claim was rejected a year ago, had tried to kill himself twice in the past and had spent time in a psychiatric clinic.
“Unfortunately, this is a new attack,” said Herrmann, according to DPA, adding authorities had not ruled out that Islamists were behind the explosion.
Ansbach is also home to a US army base and the 12th combat aviation brigade. A spokesman said the base had no information about the explosion.
The blast is the third incident to hit the southern German state of Bavaria in a week after nine people were killed in a shooting rampage in Munich and several wounded in an axe attack on a train that was claimed by the Islamic State.
Syrian refugee hacks woman
Earlier on Sunday, a 21-year-old Syrian refugee was arrested after killing a 45-year-old pregnant Polish woman and injuring three in the southwestern city of Reutlingen near Stuttgart.
Police said that incident did not bear the hallmarks of a “terrorist attack”.
“When a man and woman have an argument, we assume that we are dealing with a crime of passion,” a local police spokeswoman told DPA.
Three people were also injured in the attack, which ended when the 21-year-old assailant was hit by a BMW.
NTV showed amateur video footage of the suspect running away from the scene before cutting to him lying on the ground, his face bloodied and his hands cuffed by police.
Europe has been on edge for months after a string of deadly attacks claimed by the Islamic State jihadist group, including bombings in Brussels and carnage at Bastille Day celebrations in the southern French city of Nice.
Obsessed with mass murder
Police released more details of Munich attacker David Ali Sonboly on Sunday, saying the 18-year-old was depressed and had spent two months in a psychiatric unit last year.
The teen was obsessed with mass killings and spent a year preparing for the gun attack that killed nine people, most of them foreigners.
At least 35 people were also wounded in Sonboly’s shooting spree, which began at a McDonald’s branch and ended with him turning his 9mm Glock pistol on himself.
Investigators have ruled out any link with the jihadists though he appears to have planned the assault with chilling precision.
Police have also arrested a 16-year-old friend in connection with the attack.
Hundreds of people, many of them in tears, gathered outside the Munich shopping centre where the attack took place to pay tribute to the victims on Sunday.