Abdifatah Shaweye, 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," Bridgye told AFP.
"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.