If you have been charging your phone with the wall charger, do it via USB. If you have been trying via USB, try with the wall charger.
Another thing you may try is changing the USB port you are currently using. Another good tip is to unplug the other devices from USB ports you don’t need at the moment.
There are various tools you can use to clean the lighting port, such as small needed, or even a toothpick. The most important thing is to do this slowly and gently. You may be shocked by all the dirt, dust and debris. Once you clean it properly, there is a great chance everything will work normally.
The thing that helped many is this: open your iPhone 4, remove the battery, blow out the dust, and put the battery back in its place. Try to charge the phone again.
Turn off your iPhone 4. Plug in the USB cable from your phone to your computer. Press and hold the home button, and connect your iPhone to the cable. Still hold the button, until you get the screen which shows the device is connected to iTunes, and then release the button. You will get the message that your iPhone 4 is there, and choose Restore. This action will erase your device, and you will set it up as new. Hopefully, you will be able to charge it normally.