The computer is a charger, although a rather lousy one. It is possible the voltage on your PC's USB port is above spec and that is triggering the warning. What happens when you plug the phone into a different port on the same PC, or a port on another PC? What happens with a regular charger? Also try a different cable if you have one.
The idea of all this is to isolate the problem to the phone itself, the cable, or the device it's connected to. If the warning comes up no matter what you connect it to or what cable you use, then it points to a possible hardware problem in the phone.