The terrestrial magnetic field is practicality constant over a distance equal to the length of the magnetic needle, i.e., its field intensity remains constant in magnitude and direction. Therefore the terrestrial magnetic field acting on the needle can produce only a rotational moment, but it cannot give a resultant force different from zero.
The field of a permanent magnet varies greatly over a distance equal to the length of the needle. The field intensity at one end of the needle is larger than at the other. Therefore the field of the magnet, when acting on the needle, gives a resultant force different from zero and causes not only rotation, but also translational motion of the needle.