The man, 28, who was armed with an axe and a knife, went to the home of Kurt Westergaard at 10pm local time on Friday, police said.
Police shot him in the leg and arm and he was arrested. The man, who is expected to recover, was later charged with two counts of attempted murder.
Mr Westergaard, 74, was commissioned by the Jyllands-Posten newspaper to produce caricatures of the Prophet Mohammed five years ago, including one which depicted the Prophet with a bomb in his turban.
He has received several death threats since the cartoon was published, but had spoken recently about trying to live as normal a life as possible at his home in Viby near the western city of Aarhus.
Mr Westergaard was there with a five-year-old granddaughter when the attacker tried to get in.
“I locked myself in our safe room. He tried to smash the entrance door with an axe,” he said.
He said that the assailant shouted “revenge” and “blood” as he tried to enter the bathroom where Mr Westergaard and the child had sought shelter.
“My grandchild did fine,” he said. “It was scary. It was close. Really close. But we did it.”
Officers arrived two minutes later and tried to arrest the assailant, who wielded an axe at a police officer. One officer then shot the man in a knee and a hand, authorities said. Nielsen said the suspect was admitted to hospital bu… >>>