It works because of how hard drives work - the heads are extended by slightly heating the bar the heads are connected to. If you're head crashing, you need a little less length, hence freezer.
What freezing the drive may achieve is either un-sticking it from the bearings (see also the "bang drive on edge" technique), or lowering the thermal noise floor in the electronics enough for marginal components to make it through the boot sequence.
It's not recommended. https://www.gillware.com/blog/data-recovery/hard-drive-freez...