Watch the tutorial here: https://youtu.be/xR_c0CxXVkE
Masking in Adobe After Effects is relatively simple.
First, you need the object you want to mask. Then, you'll need a shape layer. Once you have those two things, you're basically set.
Here's how you do it:
Create whatever shape you want for the mask. You can also use the pen tool to create shapes.
Move that shape over the object you want to mask. Most importantly, the shape layer needs to be above your object layer.
With your layers stacked correctly, select the track matte dropdown menu on your object layer. You can choose either Alpha Matte or Inverted Alpha Matte. They'll both get the job done.
Once you set the track matte, boom. You're done. Congrats. You have a mask.