We know that magnetic does not do any physical work . Now consider; we attached a magnet in a wall with help of a tape. Now we bring a magnet near to other magnet and released we see that magnet will displace towards other magnet. How was the work done on the second magnet to traverse the distance ?
1 Answer
When you bring the second magent close to the one taped, you are actually taking it into it's field.Now you have given the second magnet some amount of potential energy while you are holding it in the other's field without letting it go. The moment you let it go that potential energy you gave it by taking it into it's field is used in moving across that distance.
Think of it the same way an meteor entering the Earth's gravitational field falls onto the ground.