With asymmetric (or public-key) cryptography, you can publish one half of your key pair to the whole world and keep the other half secret. People encrypt to your public key; only your private key can decrypt. The same pair can work the other way for signatures: you sign with the private key, and anyone with the public key can verify it.

That solves a problem symmetric ciphers like AES can't solve on their own: how two strangers agree on a secret over a channel someone else is watching. In practice, almost every system uses asymmetric crypto only for the setup, then switches to a fast symmetric cipher for the actual data. PGP does it, TLS does it, and Tor does it with each relay in your circuit.

Common algorithms include RSA, which is older and needs big keys, and elliptic-curve schemes like Curve25519 and Ed25519, which are smaller and faster. A v3 onion address is literally an Ed25519 public key encoded in base32, with a checksum and version byte added.

The weak spot is rarely the math. It's knowing that a public key really belongs to who you think it does. That's what fingerprints, key signing and signature verification are for.