Why is the phone overheating after replacing the battery

The old battery stopped charging so I got a new battery and replaced it. As soon as I connected the battery the whole phone started to get warm before even turning it on, then I couldn’t even hold the phone it was so hot. I turned it on and I got an overheating warning as soon as the screen came on. The phone wouldn’t cool down until I opened it back up and disconnected the battery even after turning it off. I don’t know if it’s the battery or the phone it’s self, does anyone have any answers? It would be very greatly appreciated

crwdns2934089:0crwdne2934089:0 crwdns2934093:0crwdne2934093:0

crwdns2934109:0crwdne2934109:0

crwdns2889612:0crwdne2889612:0 0
crwdns2934285:0crwdne2934285:0