Shortly before noon, the two explosive-laden cars went off simultaneously in a commercial area of the Shiite-dominated Husseiniyah district in northeastern Baghdad, a police officer said.
Two policemen were among the dead. At least 26 people were wounded in the attack, he added.
A medical official confirmed the casualty figures. Both officials spoke on condition of anonymity as they were not authorized to brief the media.
He met with Iraqi President Fuad Masum, Foreign Minister Ibrahim al-Jaafari and parliament speaker Salim al-Jubouri. Ban is also scheduled to meet Prime Minister Haider al-Abadi.
The attack and the visit come as Iraqi government forces, backed by airstrikes from the U.S.-led international coalition, are battling Islamic State militants to recapture the city of Tikrit, north of Baghdad.
The extremist group occupies large areas in northern and western Iraq captured during a lightning blitz last summer.