Here are your parts
Replacement parts for WHIRLPOOL WED5790VQ1 29" ELECTRIC DRYER | AppliancePartsPros.com
See the attachment for the wiring diagram.
Turn the timer to timed dry.
Now does it work?
If yes then you probably have a grounded heating element.
The element has broken and is touching the case/frame so part of the element is heating up but only with 120 volts.
In timed dry the timer motor gets power (240 volts) directly from the line.
In auto modes it gets power through the heating element when the heater is shut off by a thermostat so for some reason it is not getting the voltage.
Remove and check the heating element usually you can see the problem.
Another way is to use a meter.
Unplug the unit and both wires to the heating element.
Check it with a meter, should be around 10 to 12 ohms.
Then check from each side of the coil to the case/frame, both should be infinite ohms (open). If not the coil may have sagged or broken and is touching the case. This can cause it to run on high and the thermostats cannot regulate it so the thermal cut-off blows.