When you take the battery out wait at least 5-10 seconds then put it back in. Tell me if it turns on by itself because it should not if you wait longer.
If you just take it out and put it back in quickly it will just turn itself on again as it think the power got cut off for a moment and wants to try to turn on itself.
Right now does it show the white samsung logo then disappear? Or does it go past that and goes to the animated samsung logo then restarts itself / hangs there?
Stuck on white logo and keep rebooting in some cases is a faulty battery. I guess you already did a wipe data / factory reset in recovery mode right?
This issue can also be caused by firmware going corrupt as well but it sounds like most likely the battery has gone bad in your case as you said it just suddenly shut off while you were using it and it would not turn on again.
So in conclusion. Try another battery because that sounds like it is most likely at fault.