Video of the incident shows a man shouting “coward” as he strikes out.
It is not clear what the motive was – some reports suggested it was against Iran’s support for Syria’s government.
Mahmoud Ahmadinejad is the first Iran leader to visit Egypt since the 1979 Islamic revolution. Showing the sole of a shoe is a grave insult in the Arab world.
The Iranian leader is attending a summit of the Organization of Islamic Co-operation, a loose grouping of 57 mainly Muslim countries.
Egypt’s new Islamist President Mohamed Morsi has sought to follow an independent path on foreign policy and travelled to Tehran soon after coming to power last year.
However, so far his talks with Iran about its policy towards Syria have had little impact.
Tuesday’s incident occurred as Mahmoud Ahmadinejad was leaving Cairo’s Al-Hussein mosque.
Video released by Turkish news agency Anadolu shows a man straining forward in the crowd with a shoe in his hand, striking out several times.
A witness quoted by AFP news agency said the man had booed and pushed a bodyguard.
The man, believed to be Syrian because of his accent, was reportedly arrested by police after being restrained by security guards.
While the motive for the attack was unclear, the visit of the president of solidly Shia Muslim Iran has caused some friction
in mainly Sunni Muslim Egypt.
Outside the mosque, four youths waved placards scrawled with slogans against Iran over its support for Syrian President Bashar al-Assad.
There was embarrassment earlier on Wednesday when one of Egypt’s top Sunni Muslim clerics, Ahmed al-Tayyeb, publicly criticized Shia Islam at a meeting with Mahmoud Ahmadinejad.
Ahmed al-Tayyeb, the grand imam of al-Azhar, Sunni Islam’s highest seat of learning, told the Iranian leader not to interfere in the internal affairs of Sunni states and condemned the “spread of Shia-ism in Sunni lands”.
He singled out Bahrain, where Iran is accused of stirring up unrest among the Shia majority against the Sunni monarchy.
E2vW7Eq2ZRgMisleading allegations, rumours and outright lies about voting and fraud are flooding online spaces in…
At least 158 people have died in Spain's worst flooding disaster in generations. On October…
Google has been fined two undecillion (a two followed by 36 zeroes) roubles by a…
Embarking on a home remodel is an exciting journey, promising enhanced comfort, increased property value,…
The US presidential candidates continued to campaign across key swing states on October 20. Footage…
Elon Musk has said he will give away $1 million a day to a registered…