He appeared in court on a stretcher with a hand and leg in plaster casts.
He did not speak but, through his lawyer, he denied the charges of trying to kill Westergaard.
Westergaard, whose five-year-old granddaughter was in the home on a sleepover, sought shelter in a specially made safe room when the suspect broke a window of the home, Preben Nielsen of the Aarhus police said.
Michael Larsen, a police spokesman, said that authorities arrived at the house minutes after receiving an alarm set off by Westergaard alerting them to the intruder.
"[The authorities] found a person and he attacked the police with an axe and a knife. He was shot in the leg and the hand and he is in hospital [now]," Larsen told Al Jazeera .
The suspect's wounds were reportedly not life-threatening.
'Ties to al-Shabab'
"... the attempted assassination of the cartoonist Kurt Westergaard is terror related."
Danish security intelligence service
Officials from the Danish security and intelligence service, Pet, said the suspect, a Danish resident, had close ties to the Somali group, al-Shabab.
"Pet assess that the attempted assassination of the cartoonist Kurt Westergaard is terror related," the agency said in a statement.
"The arrested individual has close relations to the Somalian terror organisation al-Shabab and al-Qaeda leaders in East Africa, and he is also suspected of having been involved in terror related activities during his stay in East Africa."
Jens Hansen from Denmark's TV2 network said the suspect was known to the intelligence service because he had some connections to people with links to al-Qaeda.
"They had obviously not seen him as that dangerous [as to be] following him," Hansen told Al Jazeera from Aarhus.
"I think it's quite a big shock to the Danish population that this has happened ... Denmark is quite a small country and we see ourselves as quite peaceful people. It is like we say 'it can't happen here.'"
Westergaard has been under police protection since his work appeared among a dozen cartoons published in the Danish Jyllands-Posten newspaper in 2005.
The drawings triggered violent protests a few months later in a number of countries around the world, and again when they were republished in 2008.
The protesters felt the cartoons had profoundly insulted Islam, which generally opposes any depiction of the Prophet, favourable or otherwise.
Several dozen people were killed during the riots at the time as angry crowds attacked Danish embassies around the world.