There are two primary reasons known to me which can make an iPhone shutdown even on good charge.
- Battery health: Over time, the battery health of your iPhone may deteriorate, which can cause it to shut down unexpectedly even when the battery meter shows that it has a good charge. You can check the battery health of your iPhone by going to Settings > Battery > Battery Health.
- Overheating: If your iPhone is exposed to high temperatures beyond acceptable limits.
- Store the device where the temperature is between -20º and 45º C (-4º to 113º F). Don’t leave the device in your car, because temperatures in parked cars can exceed this range.
- Use iOS devices where the ambient temperature is between 0º and 35º C (32º to 95º F). Low- or high-temperature conditions might cause the device to change its behavior to regulate its temperature. Using an iOS device in very cold conditions outside of its operating range might temporarily shorten battery life and could cause the device to turn off. Battery life will return to normal when you bring the device back to higher ambient temperatures. Using an iOS device in very hot conditions can permanently shorten battery life.