Joel Shindani Malu was arrested overnight on suspicion of possessing drugs, Bangalore Police Commissioner Kamal Pant said on Twitter.
Pant said Malu complained of chest pains and was moved to a private hospital where he died.
Later in the day a group of foreign nationals gathered near the police station to protest against the death, Pant said.
The Hindu newspaper said they were members of the "Pan African Federation", a group set up to protect the rights of African students and professionals in the city.
Police mounted a "lathi" (baton) charge after one of the protesters attacked an officer, Pant said.
"Investigation into the death is being conducted as per NHRC (National Human Rights Commission) guidelines including inquest by a judicial magistrate. The investigation has been transferred to CID (Crime Investigation Department)," Pant tweeted.