Is there a way to generate a password from another but those 2 will have no relation? For example I have the password X and I want to encrypt 2 different things. Even if one of them was stolen due to a keylogger, other will be completely safe. I wonder how safe something like this would be if the master key is completely random, secure and unknown. Also with what algorithm, program would i be able to do this on Linux systems?

I think something like this is possible actually because of Electrum's key generation method. It uses one master private key to generate all the addresses and private keys.
Using the HKDF algorithm would work:

prk = HKDF-EXTRACT(salt, master_key)

Key1 = HKDF-EXPAND(prk, "info 1", digest_len)
Key2 = HKDF-EXPAND(prk, "info 2", digest_len)


This creates two keys that are generated from the master key, but given Key1, someone else wouldn't be able to generate Key2, as they don't know the master key.