It is due to the shape of the mirror. The mirror is curved inwards to make this happen. For example, look at this image:

The ray A has been reflected downwards and the ray D has been reflected upwards which makes the image you see look upside down.
If you look at the mirror before the focal point (F), the image will be right side up but magnified due to the parabolic shape.That the magnifying mirror requires your face to be within 5 inches for a clear undistorted image.

