The replacement battery might be low-quality, defective, or not fully compatible with your phone model. Aftermarket batteries sometimes don’t meet the same standards as original ones, leading to overheating.
If the battery wasn’t installed correctly, it could cause excessive power draw or short circuits, generating heat.
You may have to recheck it out and make sure everything is tidy.