It's to accommodate the relatively large wheels of the landing gear. The P51D wing-root shape, at the leading edge, is slightly different to the P51B/C, due to a slight difference in the size of the wheels. Although the actual room required was fairly small, the fairing was designed to maintain the integrity of the airfoil section, in order to maintain the laminar flow effect.
Terry.