Police said 12 people were wounded, including three seriously, in the attack in Ansbach, a small town of 40,000 people southwest of Nuremberg that is also home to a U.S. Army base, according to Reuters.
The incident will fuel growing public unease surrounding Chancellor Angela Merkel's open-door refugee policy, under which more than a million migrants have entered Germany over the past year, many fleeing wars in Afghanistan, Syria and Iraq.
"It's terrible ... that someone who came into our country to seek shelter has now committed such a heinous act and injured a large number of people who are at home here, some seriously," Bavarian Interior Minister Joachim Herrmann told reporters at a hastily convened news conference early on Monday.
"It's a further, horrific attack that will increase the already growing security concerns of our citizens. We must do everything possible to prevent the spread of such violence in our country by people who came here to ask for asylum," he said.
Herrmann said it was unclear if the man, who arrived in Germany two years ago and tried to commit suicide twice before, had planned to kill only himself or "take others with him into death".
It was the fourth violent incident in Germany in a week, including the killing of nine people by an 18-year-old Iranian-German gunman in Munich on Friday.
Read alsoMunich police report 10 dead, 16 injured after Friday shootingHermann said the man, whose identity has not yet been released, had been living in Ansbach for some time. Although his application for asylum had been denied, he was not in danger of being deported immediately given the civil war raging in Syria.
He said he could not exclude the possibility of an Islamist-inspired attack, noting the man's backpack was filled with explosives and metal parts that would have been sufficient to kill more people. He said investigators would work tirelessly to investigate the attack and fully understand the man's motives.
One U.S. intelligence official, speaking on condition of anonymity, said investigators would focus on what the bomber was doing before he left Syria, why he was denied asylum, and whether the attempted attack was personal or political.
Herrmann said the man had apparently been denied entry to the Ansbach Open music festival shortly before the explosion, which happened outside a restaurant called Eugens Weinstube.
Earlier on Sunday, a 21-year-old Syrian refugee was arrested after killing a pregnant woman and wounding two people with a machete in the southwestern city of Reutlingen, near Stuttgart.
"After what just happened in Munich, and today in Reutlingen, what you hear about, it is very disturbing, when you know that such a thing can happen so close to you, in such a small town as Ansbach," Debinski said.
Read alsoAfghani man attacks train commuters in Germany with axeA refugee from Pakistan wielding an ax wounded five people near Wuerzbuerg, also in southern Germany, before he was shot dead by police a week ago.
Police said neither Sunday's machete attack nor Friday's shooting in Munich bore any sign of connections with Islamic State or other militant groups.
Islamic State claimed responsibility for the July 18 ax attack in Wuerzbuerg. The group also claimed responsibility for the July 14 attack France, in which a Tunisian man drove a truck into Bastille Day holiday crowds in the French Riviera city of Nice, killing 84 people.