When you log in to the command line, a variety of environment variables are automatically set. In other words, running cd $HOME is the same as running cd /home/ubuntu, assuming your home directory is /home/ubuntu. In the command cd $HOME, the $HOME part is a reference to the HOME variable, and is replaced by the path to your home directory when the command is run.
In programming, variables are used to store data and to be able to reference and retrieve that data at a later point using a name. Another way of providing context is through something called environment variables. In the last chapter, we talked about how your 'current directory' provides context for commands you run.