Do I have to hardwire my electric garage heater, or can I use an existing 240V receptacle?
Well, for one thing you'd void the warranty, though that's not exactly a safety concern. For another you're plugging it into a 40A circuit, when it's only supposed to be on a 30 amp circuit - that is a safety concern.

I'm trying to remember what the usual logic for prohibiting plugs is - on the one hand, the plug is rated for more amperage than the device, on the other, plugs are not quite as good conductors as wires, and may heat and become worse when used in a continuous (which means 3 hours, by NEC definitions) manner - electric heaters are generally defined as continuous loads (they could be left on that long, even if you don't intend to.)