Ecology is the study of how living organisms interact with each other. Ecologists may study only part of an ecosystem, for example how a pride of lions in an African Savannah interact with each other and with their environment. They may study how agriculture affects the local ecosystem.
An ecosystem is a community of animals, plants etc together with non living stuff that affects these organisms. An ecosystem can be as large as the whole Earth or as small as a puddle. Ecosystems include autotrophs, that is living organisms that derive energy from non-living sources. Mostly autotrohps are photosynthetic plants that get energy from sunlight but some ecosystems in dark caves or by hydrothermal vents get energy from chemical reactions.