Microwave ovens often have built-in safety features to prevent overheating, and one of the safety features is an automatic thermal cutoff or overheating protection.
For your reference, here is the principle of overheating protection:
There is a thermal sensor inside the microwave just around the magnetron. When the internal temperature reaches a certain level, indicating potential overheating, the sensor triggers the cutoff mechanism. This mechanism shuts off the power to the microwave, allowing it to cool down.
If the microwave runs for a short period but triggers the cutoff mechanism, please check if the ventilating system works properly.