It's a very detailed process, but I can give you a basic understanding.
When you want to send a message to someone, and you don't want others to possibly read it too, you encrypt it. Encryption is where you replace the letters in your message with random symbols, so when anybody who doesn't have the key, they only see random characters.
The key is like... the answer key to your code. So I want to send this message: "I love you" and encrypt it, the computer would automatically assign characters to each letter. It's like those things they put in children's coloring books that look like this:
_ _ _ _ _ _ _ _.
A = #
B = $
and so on.