It can be heating. You should also consider replacing the thermal paste and cleaning up the fans.Woohoo, the laptop stayed on long enough for me to create a bootable disk.
For what it's worth, it's running Monterey 12.7.1. What happens is the mouse pointer stops responding, the fans come on, then it shuts down.