g = GM/R^2
as we move towards the core, the radius of the earth decreases but along with that the mass also decreases. their cumulative effect is to decrease g.
but in case of magnetic field, there is no such relation. as we move towards the core, we get closer to the magnetic core, and hence the magnetic field increases.