Each cryptocurrency uses a certain encryption algorithm in its structure and the miners decipher it. The node, which successfully solved the problem, receives for this a reward in the form of coins in this cryptocurrency.
Some algorithms are more popular and are used for several different cryptocurrencies. Here are the four most famous of them: SHA256 (Bitcoin and Bitcoin Cash work on it), Ethash (Ethereum), Scrypt (Litecoin), and anonymous CryptoNight (Monero, Bitcoin).