What's at the other end of the cable? (is the USB port built in to your car, head unit, or is it a 12V charger).
the phone recognizes the charger as a computer due to signals on the data lines. The middle two pins/wires in the rectangular USB connector. You may want to look for debris in there as an intermittent contact may cause this kind of behavior.
B