Try to
put your iPhone 4 in DFU mode and then restore it.
You can try these steps below:
1. Try another USB cord.
2. Restart your computer for a try.
3. Hold the power button, it might restart your iPhone.
4. Update your iTunes to the latest version. Plug in your iPhone.
If iTunes can't recognize it, then in iTunes in the top left corner click help > run diagnostics.
On the box that comes up, check the last two things. Click next and it should identify your iPhone and then restore it.
Moreover, you can also
get your iPhone out of recovery mode directly with some third-part software.