GFCI outlets are designed to protect people from electric shock.
The current at an outlet flows from the hot wire to the neutral wire and the current flow is balanced (equal). The GFCI outlet monitors this flow and will trip the circuit if there is any interruption or imbalance in this flow. It is able to sense an imbalance as small as 5 milliamps and can react in less than a second.
The GFCI outlet will also protect regular outlets that are wired to the same circuit as the GFCI outlet. In electrical terms, it will protect outlets that are wired “downstream” from the GFCI outlet.