Hey Maggie, thanks for the question! The $ is necessary because it is doing a command substitution. Basically what it does is it allows a command to be run and its output to be pasted back on the command line as arguments to another command. -c executes the command which downloads Homebrew. I got this command directly from https://brew.sh/, you can read their documentation there.
