Chosen Solution

My iPhone won’t charge when connected to USB port

Try using a different USB cable or power adapter. That may fix it. If not, there may be a problem with the lightning connector. Make sure the connector is plugged in. Also, it could be a battery problem.

It’s probably Just yr cable, try another lead first. If won’t turn on still, just hold power & home button together till Apple

If it is not the battery or the USB cords, there is a charging port device in the phone which is an inexpensive replacement. Call someone who can service iPhones in your area. Unlikely but more serious–a U2 IC chip is bad–which may have to be replaced by Apple.