It sounds like an issue with the USB ports on your MacBook. Are you able to use the same USB port to attach an external hard drive? If not, try resetting the SMC. If that doesn't work the USB bus may be defective in that it can not supply enough charging current for the iPhone. Only cure for that is a new logic board.
It sounds like an issue with the USB ports on your MacBook. Are you able to use the same USB port to attach an external hard drive? If not, try resetting the SMC. If that doesn't work the USB bus may be defective in that it can not supply enough charging current for the iPhone. Only cure for that is a new logic board.