What does it mean when the flag is flown upside down?

An American flag or for that matter any flag flown upside-down is considered a sign of distress...

US Code:T36 Ch10.176
(a) The flag should never be displayed with the union down, except as a signal of dire distress in instances of extreme danger to life or property.

Mutiny, piracy, sinking, coup, rebellion of the people/government.
The fact that any flag flown upside-down means distress is not the whole story however... flags flown upside-down can and are used as a form of protest.
The flag is a symbol of control and superiority. The use of such in any other way is considered "desecration."