The Garden City Mall, one of the biggest shopping centres in the city, has also been evacuated.
One of the men refused to be searched by security guards and was overpowered in a scuffle, a witness said.
In 2013, al-Shabab gunmen killed 67 shoppers at Westgate mall in the city.
Police spokesman George Kinoti said the three men in custody were all Kenyans and the explosives were discovered in one of their bags.
The BBC’s Alastair Leithead in Nairobi says it is believed to have been a small explosive device with a battery and a mobile phone attached, which could have been used as a trigger.
Private security firm Securex Agencies has told people to avoid the area near the Garden City Mall on Thika road in north-eastern Nairobi until it had been “declared safe by the authorities”.
Since the Westgate siege, al-Shabab has launched a number of high-profile attacks, including one on a university in Garissa, in north-eastern Kenya, in which close to 150 people died in April.
Security at Nairobi’s shopping complexes has been stepped up since the 2013 attack.
The Westgate shopping reopened in July.