Here’s what to do:
1. Your phone’s software might be messed up — you gotta reinstall the official system (called firmware) using a tool called Odin on your PC.
2. If that doesn’t work, your battery might be dying and causing the phone to freak out. Try swapping the battery.
3. If still nothing, some hardware inside your phone might be broken, and that’s a pain to fix without a pro.
So, first try flashing the system with Odin, then change the battery, and if it still sucks, get help or consider replacing the phone. Simple.