My question is that if magnetic field cannot do work, then what does
the energy signify?
The energy stored in the magnetic field of an inductor can do work (deliver power). The energy stored in the magnetic field of the inductor is essentially kinetic energy (the energy stored in the electric field of a capacitor is potential energy). See the circuit diagram below.
In the diagrams the voltage source is a battery. In the top diagram the switch has been in the closed position for a long time so that all transients have disappeared. Under these conditions the ideal inductor looks like a short circuit. So the voltage across the inductor is zero and the current in the inductor is
$$I_{L}=\frac{ε}{R_2}$$
The current in $R_1$ is zero and the energy stored in the magnetic field is
$$E_{L}=\frac{LI_{L}^2}{2}$$
In the bottom diagram the switch is opened at time $t=0$. The instant the switch opens the current in the inductor is the same $I_L$ as before the switch was opened since you can't change the current in an ideal inductor instantaneously (in zero time). So the initial current in $R_1$ is now that same $I_L$. The inductor is now delivering energy to the resistor which is dissipated as heat. The current decays in time according to
$$i(t)=I_{L}e^{-R_{1}t/L}$$
Eventually becoming zero when all the energy that was stored in the magnetic field is dissipated as heat in $R_1$.
Here, the magnetic field does no work. It gets converted to electric
field in the wire which makes the electrons move against the
resistance which in turn dissipates as heat
I said the energy stored in the magnetic field does work, not that the magnetic field itself does work. The mechanical analogue is the kinetic energy stored in a moving object can do work when bringing it to a stop. Mass is the analogue of inductance. The velocity of the mass is analogous to the current in the inductor. The inertia of mass that resists a change in its velocity is analogous to the inductor resisting a change in current.
Hope this helps