Do you ever need to drive something with more power than your microcontroller pin can handle? That is where MOSFETs come in. They are digital switches that can handle much more current than a GPIO pin.

An embedded microcontroller utilizes input/output (IO) signals to
communicate with the outside world. The simplest form of IO is
commonly referred to as general purpose input/output (GPIO) where
the GPIO voltage level can be high, low, or high-impedance. Pulling
resistors are used to ensure GPIO is always in a valid state.

General purpose input/output (GPIO) pins on microcontrollers have various modes
for both input and output. Input modes may include pull-up or pull-down resistors,
hysteresis, or some combination. Output modes can be push-pull, high-drive or open-drain.