What is the reason why an accelerometer shows -1g value when it's flips?

The accelerometer actually measures the difference between the forces applied to the internal sensor (think of it as a mass hanging from a spring) and the sensor mounting frame, which is the black chip itself.

When the accelerometer is in free fall, the force of gravity is applied equally to the sensor and the chip, so the accelerometer reports zero g.

If the accelerometer is prevented from falling, something is holding the chip up while gravity pulls both the chip and the actual sensor down. 1 g is reported.

Flip the accelerometer over and the sign changes, because the force holding the chip up is coming from the other side. -1 g is reported.

If the two results are not exactly +1 g and -1 g, for all three axes, the accelerometer needs to be calibrated. See Tutorial: How to calibrate a compass (and accelerometer) with Arduino | Underwater Arduino Data Loggers