Mannheim police chief Siegfried Kollmar said the gunman had been found with 100 spare bullets in his backpack and it was not clear why he had stopped shooting, but officers were confident he had been acting alone.
Police have searched his home in Mannheim, in southwestern Germany, but it was too early to detect a motive, a state prosecutor told the same news conference.
The shooter had bought two guns, including a double-barrelled shotgun, abroad but did not have a licence, Kollmar said.
"The suspect had no driving licence. The suspect had no gun licence. This makes him a very unusual case," Kollmar said, confirming he was a student.
The prosecutor said the suspect had no previous criminal record in Germany.
One of the four German students wounded in the attack, which occurred around midday, was a 23-year-old woman who died of her injuries, the interior minister of the state of Baden-Wuerttemberg Thomas Strobl told the news conference.
The three other victims suffered minor injuries, Stobl said.
The police chief said 29 witnesses in the lecture hall had told officers "only one person went in, shot and went out, and no one else was seen".
A police spokesman told Reuters earlier on Monday the gunman fled the lecture hall before turning his gun on himself.
Founded in 1386, Heidelberg is Germany's oldest university.