The incident occurred Friday at Mellat Park, in the north of the capital, during the Muslim festival of Eid al-Adha, Tehran's Police Chief General Hossein Rahimi told ISNA.
"Unfortunately, some people started to wave the Taliban flag during this gathering," he said, adding that Afghan nationals attend such events each year, according to AFP.
ISNA said pictures of the gathering were posted on social media and that some had claimed it involved members of the Taliban group.
It came during a three-day cease-fire in Afghanistan between the Taliban and Afghan security forces over the Muslim festival which ended on Sunday.
According to Rahimi, five of those arrested following investigations had "produced the flag, taken pictures and video and given them to hostile media".
The rest were "mostly illegal nationals who are being deported".
According to the United Nations refugee agency UNHCR, about 3.5 million Afghans, including almost one million refugees, live in Iran.