Magnetic mines respond to, of course, magnetic fields created by large steel objects such as ships and subs.
The de-gaussing gear creates a false magnetic field which sets off magnetic mines. All the aircraft has to do is fly over the mines and they will explode.