a magnet which can be turned off (but doesn't require power to stay on)

Perhaps something like this would work for you:Magnetic switchable device - Wikipedia.

If you removed the detent, the magnet would turn easily. Then figure out a way to have an Arduino control it.

Paul