2. Now after 2 years this seed phrase is used at electrum to restore it, how does electrum know what kind of wallet adresses are behind these seed phrase?
because there is no central database to gather the information as its decentralized?
So is there anything encrypted behind these 12 words which gets decrypted? So all the providers uses the same script to generate a compatible seed phrase for wallets? and how do they avoid that a seed phrase wont be generated twice?
A mnemonic or seed phrase is just an encoding of a fixed size entropy. Since the size of that entropy is big (from 128 bits to 256), as long as they are generated randomly it is impossible to find a collision aka to "generate it twice".
This entropy is used as the input to a key derivation function that allows you to derive child keys that are 256-bits. You can use this 256-bit derived key for whatever you want. It can be used to generate another mnemonic (24 words) or as a password, or as an altcoin private key!
BIP39 which is the most common mnemonic algorithm in use has no way of telling the wallet which type of addresses to derive. You have to manually tell it (eg. tell it to derive P2PKH addresses), then it derives those keys normally at the specific derivation path and uses the corresponding public key to create the appropriate address.