USB malfunction and rooting of my Samsung SIII (GT-I9305)
This sounds like either only one or even both central connectors of your phone's micro-USB port are broken. Charging only uses the outer ones which let's you use the charger.
If I assume that by detecting your flash drive you haven't accessed it, then it's this.

You are able to root your device (I got the same one) without a USB connection using TowelRoot, FramaRoot or a flashable .zip (visit xda-developers for more info(1) or (2))