(Crazyflie 2.0 + PX4) Compass issue

It is because DC motors distorted the magnetic field around as they are very close to onboard mag. It is inevitable in such a micro size frame.
You can use LPE for indoor flight testing which ignores internal mag offset.

Or if you do need compass indoor then check this out:

NanoMind + nanoCompass