Try booting the phone to the safe mode. (1) Turn the phone off (2) Turn it on again (3) Once you see the Samsung logo, press and hold volume down button. Hold it until the phone boots. (4) Once the phone boots there should be "Safe mode" written in the left bottom corner. Use the phone in safe mode for some time. Note that most apps won't be accessible in safe mode. If the issue disappears it's a software problem. To fix it, do following. (1) Uninstall apps starting with the ones you installed most recently. An app could be causing the issue. (2) If you find that it's not an app causing the problems, try factory resetting your phone. If the issue persists in safe mode the battery is most likely at fault. Replacing battery requires specialized equipment so I'd suggest you search for a professional repair shop in your area to do it for you.
It's most likely no longer supported by Google due to the Android version being too old. You could try rooting the device and installing alternative ROM with newer Android version, but be aware that it's not without risks and as this phone is very old, newer versions might not work properly. This iFixit guide should give you some pointers to installing alternative ROMs to Android phones.