Corals are ancient life forms that evolved into the reef building forms over the last 25 million years. A young coral larvae is called planula, and it looks like this,
These are free floating organism just like plankton.
Corals are both plant and animal. It is similar to lichens which are symbiotic association of algae and fungus. The mutual association is so close that it is difficult to differentiate between plant and fungi and hence it is categorized as both plant and fungi.
A mature animal part is called polyp. We can see stinging tentacle like structure around its mouth. These help it to grab food (and protect). Polyp is covered with exoskeleton (a hard covering of calcium carbonate) . In a reef, there may be several Polyp sharing a common exoskeleton.
Algae are other microscopic plant organisms which form coral reef. They are essential as they are the one which convert calcium carbonate from sea to calcium carbonate in exoskeleton.
A coral ecosystem also includes fishes, reptiles and molluscs (eg Octopus, Squid, Oysters). A coral ecosystem has highest efficiency.