IRF540N based battery discharger
Am I missing something?

I've taken the safe operating area graph from the data sheet and superimposed a couple of extra red lines that correspond to MOSFET active time durations of 100 ms and 1 second: -

The lines I've added will be roughly correct given that for a ten-fold increase in time period, the successive lines drop by about the same amount. But, it is open to interpretation I grant you.
However, if we assume that my extra lines are about right, then with a drain-source voltage of about 14 volts, we should not allow the drain current to be greater than about 3 amps for longer than 1 second.