I would first do a Restart
If that does not make the problem go away, do a Restore
The Restore will erase the iPod, reinstall its software, and set it to default settings.
It's possible that the charging issue is separate from the turning off issue. As a test, you should shut down (power off) your computer and disconnect all USB devices including hub, except for keyboard and mouse (if normally used). If your computer is a laptop, connect its power adapter (so that it's not running on battery power).
Start up the computer, run iTunes, and connect the iPod to direct USB port on the computer. This is to rule out USB device conflict and lack of available power on the USB bus. See if charging is more reliable, with only the iPod connected.
You should also rule out a fautly (or unreliable) USB cable. If possible, try a different USB docking cable.
The final possiblity is a hardware problem, related to the battery or charging.