The attacker, who was believed to have been armed with a knife, was shot and injured by police in a brief standoff after fleeing the scene on foot, according to the BBC.
His motives are unclear, but terrorism is not suspected and he is thought to have acted alone, police say. In December an attacker drove a lorry into a Berlin Christmas market, killing 12 people and injuring more than 50.
Police were unable to confirm local media reports that the Heidelberg attacker was mentally disturbed.
--This story is developing.