Decryption only works when the party holding the correct key reverses the exact mathematical transformation that produced the ciphertext, which is why key management, not the decryption algorithm itself, is usually the weakest link in practice.
Two broad models exist. Symmetric systems use one shared secret to both lock and unlock data, which is fast but requires a secure way to distribute that secret. Encryption in blockchain contexts more often relies on asymmetric, or public key, cryptography: a message locked with someone's public key can only be opened with the matching private key. This is the mechanism that lets a wallet owner prove control of funds without ever exposing the secret that grants it.
Most day-to-day wallet software goes a step further and encrypts the private key itself before storing it on disk, typically inside a keystore file or an encrypted wallet.dat. Opening the wallet decrypts that key with a password-derived cipher, briefly loads it into memory to sign a transaction, then discards it, so the raw key is never left sitting in plaintext.
Decryption failures carry real consequences in crypto: a forgotten password can make an otherwise intact encrypted wallet file permanently unreadable, since there is no central authority able to reissue or reset the key. Elliptic curve cryptography, the standard used by Bitcoin and Ethereum, makes deriving a private key from its public counterpart computationally infeasible with current hardware, though researchers continue to study how future quantum computers could eventually change that calculus.