The man attempted to enter the barracks on foot at around 7:45 a.m. (0545 GMT; 4:45 a.m. EDT), taking advantage of the main gate opening to allow an authorized car through, said Col. Giuseppe Affini, a chief spokesman for the army in the Lombardy region that includes Milan.
"He was immediately blocked by the guard, who yelled 'Halt.' He exploded the briefcase that he was holding," Affini said.
Authorities said the man appeared to be acting alone, and Affini denied initial media reports that the man had shouted "Out of Afghanistan!" He said the man had shouted something in Arabic, but that it was not clear what.
Some of the 2,800 troops that Italy has deployed in Afghanistan are based in the army barracks that was targeted, Affini said.
"It is a serious incident from all points of view, but it should not be exaggerated," Milan Prosecutor Armando Spataro told a news conference.
The explosives caused little damage to the structure "which demonstrates that there was not a significant quantity of explosives," Spataro said. The 20-year-old guard was lightly hurt and treated at the scene, Affini said.
It was not yet clear if the suspect made the explosive device himself, Spataro said.
"It seems like an isolated act," Francesco Rutelli, a lawmaker who heads a parliamentary committee that oversees secret services, told Radio 24.
The attacker was being treated at a Milan hospital for injuries to his hand and his face which were not life-threatening, authorities said.
Police, who identified the attacker as a 35-year-old Libyan with legal residence in Italy, were searching his apartment in Milan for clues as to the motive.
However, police said it did not appear related to a case involving two Moroccans who were arrested in December for allegedly planning terrorist attacks against targets in Milan. Spataro said the barracks was never identified as a target in any anti-terrorist investigation in Milan, and that the Libyan suspect was previously unknown to investigators.
One witness, Lt. Giovanni Lo Bianco, was in another car waiting to enter the barracks when he saw smoke from the attack. He and other military personnel arriving for work cleared passers-by from the street and secured the area in case there was a further attack.
"Having experience in Afghanistan, we expected that this could be a trap to harm as many people as possible," said Lo Bianco, who served four months in Afghanistan in 2005-6.
Associated Press writer Alessandra Rizzo contributed to this report from Rome.