The Invert function converts every color in the selection to its opposite. For example, black becomes white, yellow becomes blue, etc. The result of this operation is similar to a photographic negative of the original image. You can see what the opposite of all colors is by looking at the GTK color selector (double-click the foreground or background color, and select the GTK tab). The opposite color is the one at the opposite side of the color wheel.

If no selection is made, the entire layer is inverted.