Somali officials said at least 18 people were killed by AU troops on Monday when they opened fire on three minibuses after a roadside bomb targeted their convoy in southern Mogadishu.
Yusuf Dhumal, a police commander, said the troops killed the civilians when they opened fire in response to the blast.
"I counted 18 dead civilians who were killed by them after spraying fire on the buses," he told the AFP news agency.
Abdifatah Shaweye, the deputy mayor of Mogadishu, said more than 20 civilians were killed in the shooting.
"The African Union forces committed mass killings today after an explosion hit their convoy. The number of innocent civilians they killed after the explosion exceeded 20," he said.
Major Bahuko Baridgye, a spokesman for the AU forces, denied the charges and said that three civilians died in the explosion that also wounded four others.
"The information we got indicates that three civilians died in the explosion and one of our soldiers was lightly injured. The vehicle was also slightly damaged," Baridgye said.
"Our forces did not open fire on people."
The peacekeeping force is made up of Ugandan and Burundian soldiers. It has been in Mogadishu for about two years and is charged with protecting key government installations.
The AU peacekeepers have often been targeted by anti-government fighters since the first Ugandan contingent deployed in the country in March 2007.
Ethiopian forces that had also borne the brunt of the armed uprising, pulled out of Somalia last month, sparking fears of a security vacuum in Somalia.
Somali legislators elected Sheikh Sharif Sheikh Ahmed, a moderate Islamist, on Saturday as the new president in a new bid to stabilise Somalia.
However, more extreme groups who have rejected the government and continue to carry out deadly attacks, remain a huge challenge to Ahmed's efforts to pacify the country.
Abdullahi Yusuf, the former Somali president, resigned on December 29 after he was accused of being an obstacle to peace by the major powers.