When a magnetic material is kept in the magnetic field then it interacts with the magnetic field of the rotating charged particles inside the atom and attracts them. It is the interaction of two magnetic fields that results in the generation of the force which attracts one particle to the other.
You will learn about this in higher grades.