It looks like something got damaged ior shorted out. I would suggest taking your phone apart, looking to see if you can spot the damaged component and replace it if you do. If you dont, try putting the phone back together, the fact something might have moved and you just put it back where it belongs might fix the issue. If not I would find out where its heating and consider if replacing that part is worth the money.
Reemplazo de la batería en el Samsung Galaxy A5
Follow that guide as it gets you into the phone.