Autotrophs are needed in every food chain in all ecosystems. They take energy from the environment (sun light or inorganic sources) and use it to make other organic molecules that are used to carry out various biological functions such as cell growth or repairing broken tissue.
Plants and other organisms that carry out photosynthesis are phototrophs (or photoautotrophs). Bacteria that use inorganic compounds like hydrogen sulfide, phosphorus or iron are called chemoautotrophs. Other organisms, called heterotrophs, eat autotrophs.
There are some species that need organic compounds as a source of food, but are able to use light as a source of energy. These are not autotrophic, but heterotrophic. A mixotroph is a (micro)organism that can use a mix of different sources of energy and carbon.