The server packs text files (HTML, CSS, JavaScript) before sending them and the browser unpacks them. This transfers significantly less data, commonly 60 to 80% less for text files. Gzip is older and supported everywhere, while brotli is newer and more efficient.
You can tell that compression is on from the Content-Encoding header in the server's response.