Corals has a special relationship with a small algae called Zooplankton. NOAA says “The algae live within the coral polyps, using sunlight to make sugar for energy.” This allows for the Coral to have food and in return, the coral gives off CO2 that the Zooplankton uses to survive as well as a place to live. At night the polyps also extend so they can catch other algae that is floating around as well as some small fish.
This begs the question of what is a polyp. Well, according to NOAA, almost all corals are colonial animals. This means that they are made up of hundreds and maybe even thousands of different animals called polyps. Every polyp has a stomach which opens up into a mouth. The mouth is then surrounded by a bunch of tentacles that are able to extend and retract. The tenticles function to get the particles of Zooplankton and small fish that are floating around through the ocean. They are also used for other things such as defense and clearing away stuff such as debris and other things that may happen to get on the organism.
In order for it to feed it stings creatures floating by with toxins that can help to capture its food. It is important to remember that it feeds at night, this makes it so the fish may have a harder time seeing threats. It basically stings the organism it wants to eat and then eats it. The algae in its skin can also make food through photosynthesis which lets it get sustenance during the day.
So, there are 2 ways that coral eat: one is that they eat small plankton and fish floating by, and the other is that the zooplankton in their bodies gives off the sustenance they need to survive.