The same reason earth or the sun have a magnetic field. But the collapse of the star's core compresses the dynamo into a much smaller volume and speeds up the rotation due to conservation of angular momentum, thus making it more powerful.
At their surface, and possibly internally, the neutronium likely breaks down, if only briefly, giving protons and electrons.
Voila, spinning charges.
Current models indicate that matter at the surface of a neutron star is composed of ordinary atomic nuclei crushed into a solid lattice with a sea of electrons flowing through the gaps between them.
I think the theory is that there is enough proton degenerate matter to form a superfluid and hold a magnetic field, even if the majority of the star's matter is neutrons.
Neutrons do have magnetic moment after all. [1] says it's about 1000 times weaker than electron, so...no idea how much it contributes to the neutron star's field as compared to degenerate electron matter crust (which is very conductive kind of fluid).
https://en.wikipedia.org/wiki/Solar_dynamo