In this scenario, the wires create a closed, loop circuit that has the capability to carry current from the negative terminal of the battery, through the circuit and back to the positive terminal. The current in our closed loop created its own magnetic field (can be determined by “Right Hand Rule”= Making a thumbs up sign with your right hand, thumb points in direction of current, and curve of finger show the orientation of magnetic field). Here, the current travelling through the coil created the armature of a motor, which induced a magnetic field and explains why the coil spins.
A more in-depth explanation is that magnets two poles, north and south. Opposite roles attract and same roles repel. Since the magnetic field created through the current (inside wire) is not perp. to magnet taped on top of the battery, part of the wire’s magnetic field repels and forces the coil to spin. Furthermore, the coil spins in only 1 direction because spinning in the other direction will make the magnetic field repel, not attract, and not allow it to spin. Theoretically, the coil would’ve spun until the battery became dead (as no current = no magnetic field).