Suppose someone records all your encrypted traffic today and, a year from now, steals the server's private key. Without forward secrecy, they can go back and decrypt everything. With it, they can't, because each session used temporary keys that were thrown away when it ended.
The trick is ephemeral key exchange. Both sides generate fresh, short-lived key pairs for each session (often using X25519), derive a shared secret, and discard the ephemeral private keys afterwards. The long-term key only proves identity; it never directly protects the data. Some people call it "perfect forward secrecy", though there's nothing perfect about it beyond the name.
Tor has it at several levels. The TLS links between relays use ephemeral key exchange, and the ntor handshake that sets up each hop of a circuit mixes in one-time keys too. When the circuit closes, those keys are gone. TLS 1.3 made forward secrecy mandatory for the web. Signal goes further with its ratchet, rotating keys message by message.
PGP is the notable exception: classic PGP email encrypts to a long-lived key, so a stolen key plus an archive of old messages is a real risk.