The key does not create the algorithm.
The algorithm is a fixed, publicly known set of steps. Clearly, a fixed, publicly known set of steps is not capable of encrypting anything.
So we include some secret information into the steps in the form of a key. A key for a symmetric encryption algorithm is a random sequence of bits that is kept secret. The knowledge of this secret random sequence of bits is what enables one to perform the encryption/decryption steps - and what prevents anyone else from doing the same.
For example, the AES algorithm uses the following steps:
- Add key
- Add constant
- Mix Columns
- Substitute bytes
Add key step is the same instruction for everyone who uses the algorithm, but the data that the instruction operates on is different for everyone because of the key.
This may be the source of the confusion. There are two things going on in an encryption algorithm:
- The instructions, or steps that are applied
- The data, which are the bits of information that the instructions operate upon
The instructions (the algorithm) are fixed and publicly known. The key is data, and it provides the source of secrecy that enables one to compute the encryption/decryption operation. The plaintext and ciphertext are also data, which are operated upon by the instructions in conjunction with the key.