Rob Macaire was held for three hours, in what the UK described as a “flagrant violation of international law”, according to BBC.
It is understood he was attending a vigil for those who died in the crash, which turned into a protest.
He left to make his way back to the UK embassy, but was arrested as he stopped at a barber shop for a haircut.
In a statement, UK Foreign Secretary Dominic Raab said: “The arrest of our Ambassador in Tehran without grounds or explanation is a flagrant violation of international law
“The Iranian government is at a cross-roads moment. It can continue its march towards pariah status with all the political and economic isolation that entails, or take steps to deescalate tensions and engage in a diplomatic path forwards.”
The Iranian Etemad newspaper shared a picture of the ambassador on Twitter after the Tasnim news agency reported his arrest.
Iranian media claimed Mr Macaire was accused of inciting anti-government protests.
Iran has said Ukraine International Airlines flight PS752 was shot down due to “human error” and there were demonstrations in Tehran and other cities on Saturday as people gathered to commemorate those who died.
Earlier, the UK prime minister said Iran’s admission was an “important first step” and called for an investigation into the “tragic accident”.