The answer to this question is simple: When you look at your hands in the mirror, you are actually looking in two mirrors: one is the actual mirror and the other one is a biological mirror. This mirror made your left hand the mirror image of your right hand. That’s why it seems that your hands are flipped horizontally in the mirror. In reality your hands don’t change places in the mirror. It only looks like they did.
You head is not flipped with your legs because when you look at your head and legs you only use one mirror (the actual mirror). Your head is not the biological mirror of your legs and again, your head doesn’t change places with your legs in the mirror.