2 Chainz was robbed at gunpoint in broad daylight Sunday in San Francisco ... TMZ has learned ... and police say the rapper's entourage fled "like cockroaches" when it all went down.
A San Francisco PD sergeant tells TMZ ... cops responded to a shots-fired call just after 4:30 PM. We're told when they got to the scene, 2 Chainz wasn't cooperative ... saying he wanted to handle it himself.
Chainz told police his wallet was stolen and that's all that happened.
Police reviewed surveillance video ... which revealed Chainz was clearly the intended target.
We're told video also shows Chainz and 14 of his people all "ran away from the incident like cockroaches running from a flashlight."