There are two very different ways to explain why something happened. You can point backward to what produced it, or forward to what it was for. The second is teleological explanation, and whether it is ever legitimate outside human intention is a question that has swung back and forth for two thousand years.
Aristotle made it central. To explain something fully, he argued, you must give four causes: what it is made of, what form it takes, what brought it about, and what it is for — the final cause. Crucially, he applied this beyond artefacts. An acorn develops into an oak not merely because of prior events but because becoming an oak is what an acorn is for; the process is directed toward a mature form. Nature, on this view, is shot through with ends.
The scientific revolution ejected this. Explaining a falling rock by its seeking the centre of the earth explains nothing you can measure or predict; explaining it by gravitation does. Purpose in nature came to look like projection — reading human intention into processes that operate mechanically. By the nineteenth century, teleological explanation of physical processes was essentially finished.
Then Darwin complicated matters, and in an interesting direction. Biologists cannot easily stop saying that the heart is for pumping blood, or that camouflage exists in order to avoid predators. The standard reconciliation is that this language is shorthand: the heart has that function because hearts that pumped blood were selected for, which is a purely backward-looking causal story wearing forward-looking clothes. Whether this fully eliminates teleology or merely naturalises it is genuinely debated — some philosophers of biology argue functional talk is ineliminable and legitimately so.
The concept also does work well outside science. Aristotle's ethics is teleological: a good life is one that fulfils the characteristic human function, which is why eudaimonia is defined through what we are for. Any account of the meaning of life that appeals to purpose is teleological in structure — and one reason the meaning question feels so difficult in a modern setting is that we inherited a teleological vocabulary while abandoning the picture of nature that made it coherent.