Police said at a Munich press conference that they had arrested the man without resistance just minutes after the attack at a local train station in Grafing, east of the Bavarian capital.
The attacker still had a 10-centimetre knife stuck in his belt which he had used to inflict grievous wounds on four people just before 5 am.
Although the four victims were brought to hospital using a helicopter and ambulances, one of them died soon after and another is in a critical condition.
Senior officers said they had so far determined that the assailant, originally from Gießen in the central German state of Hesse, arrived in Munich on Monday by train.
He hung around the Munich main train station after finding he couldn't afford any of the hotels nearby before taking an S-Bahn train to Grafing, a sleepy commuter suburb of 13,000 people, early in the morning.
Security video footage shows that he arrived there at about 2 am and remained at the station until the attack.
No police record
Police and state prosecutors at Tuesday's press conference confirmed that the man has no criminal record and has no known links to terrorism or religious fundamentalism in either police or intelligence databases.
Neither is there any evidence that he might have become radicalized through online materials such as videos.
Both the perpetrator himself and a witness confirmed that he shouted “Allahu akbar” – “God is great” in Arabic – during the attack.
But officers were unable to get from him an explanation as to why he called out those words or – as another eyewitness reported – shouted at people nearby in German that they were “unbelievers”.
Neither could they discover any reason why he had travelled to Munich or on to Grafing, apparently “a crime scene chosen at random,” Petra Sandles, deputy head of Bavaria's detective force, said.
Police in the man's home town of Gießen had been called to some kind of disturbance he was involved in two days ago, but released him.
“There was no reason to believe that the man was a danger to himself or others,” Bavarian state security chief detective Lothar Köhler said.
Officers who interrogated the man were unable to agree on whether he was suffering from psychological disturbances, senior prosecutor Ken Heidenreich said.
The knife attacker will appear before a judge on Wednesday on suspicion of one count of murder and three of attempted murder.
Prosecutors plan to have him examined to decide whether he should be committed to psychiatric care or held in custody, Heidenreich added.