>>40725106The actual animal portion of the coral is called a polyp, tiny sea anemone-like organisms that secrete their shells. Their color comes from zooxanthellae, a type of algae that lives in their bodies. The algae photosynthesis like plants and the polyp gets energy from that.
However, when the water temperature gets too high, the algae dies or is ejected from the body (turning the coral white). The polyp can’t get energy from it anymore and starves to death.