I’ve seen this a couple of times in the C172 G1000. Pressing “D” solved it.
That’s the default keybord shortcut for aligning the gyroscopic heading instrument with the magnetic compass, so I guess it shouldn’t be required, or even functional, with a G1000, but apparently it can be used to circumvent what seems to be a bug.