It could be the port has a problem, it could be that the battery is going bad. Additionally, it could be that something you are running on the tablet (or is running) is draining the power which is causing the charging to be slow.
You can try starting it up in "Safe Mode" (instructions below) and see if it charges faster in there (and without the restart). If it does, the you have something on the table (virus, malware, bad app, etc.) that is the problem. However if it acts the same in "Safe Mode" and won't charge quickly, or requires you power off and back on, then I would look into it being the battery that is the problem next.
To get into "Safe Mode" please do the following.
1. First turn off the tablet.
2. Next press and hold "Power" until you see the manufacturers logo on the screen, then release the power button.
3. "Quickly" press "Volume Down" and hold it for few seconds until you see the message "Safe mode: ON" or something similar.
4. If you wanted disable it, simply repeat the steps above, and you should see "Safe Mode: OFF" rather than on.