Need help understanding a Geocaching gadget

Hi!

I'm new to Arduino, but I find it very interesting.

There's a project I would like to try out, but I need some help understanding how it's done.
I want to make something like this:

What I need to understand is how the lock locks when he flips the battery.
You might not even need an Arduino for this?

Hi, welcome to this forum,

He probably... uses an electromagnet to move a normal constant magnet.
By flipping the battery north- and south-pole of the electromagnet are swapped, which moves the other magnet from one side to the other. By flipping the battery once more, the constant magnet moves back to its original position.

You indeed don't need more as battery, electro&normal magnet, plus wire for a lock like this.