To make clay into pottery it is fired. Different clays contain a different mix of minerals. When it is heated to about 1000 °C, some of these minerals partially melt, and cause the clay to turn into a ceramic.
There is a limit to how hot you can heat the clay. If you make it too hot, the clay will melt, and sag in the kiln. In extreme cases the clay can melt completely and the pot will become a puddle (You then have a big job scraping melt off the kiln floor.)
Some clays can survive higher temperatures. These can be heated to 1200 °C or even higher without sagging. At these temperatures the clay particles bond together to become waterproof. This is called "stoneware". A particular type is "Porcelain" that has a large amount of kaolin clay. Porcelain is especially strong, so it can be made very thin.
Most clay can't be heated this much, and is heated to 950-1150 °C. At these temperatures the clay particles are bound less tightly together and the fired body can absorb water. This is called "Earthenware". Earthenware may be white, grey or red and it is often glazed to make it waterproof.
Terracotta is one type of earthenware. It is an iron rich earthenware (and so a rusty red colour) that is often left unglazed so that it can absorb water. It is used for a range of applications. Plant pots, flooring and roofing tiles and storage jars, but not usually for plates, cups or other crockery.
So Earthenware refers to the type of clay, and terracotta is a type of earthenware.