All tequilas are mezcals, but not all mezcals are tequilas.
Tequila is a type of mezcal, much like how scotch and bourbon are types of whiskey. According to spirits writer John McEvoy, mezcal is defined as any agave-based liquor. This includes tequila, which is made in specific regions of Mexico and must be made from only blue agave (agave tequilana).
They're made with different kinds of agave.
Mezcal can be made from more than 30 varieties of agave. According to spirits writer Chris Tunstall, the most common varieties of agave used for mezcal are tobalá, tobaziche, tepeztate, arroqueño and espadín, which is the most common agave and accounts for up to 90% of mezcal.