The question of the origin of the elements of the Mendeleev table has triggered many lively discussions in the first part of the twentieth century. Some researchers thought that all the elements were produced during the early phase of the evolution of the Universe, while others had the opinion that the stars were the cauldrons in which all the nuclear cooking occurred. I shall explain why neither of these views was correct and how it was possible to make progresses in our understanding. I shall then continue by reviewing the physical principles that govern the evolution of stars and by describing the main nucleosynthetic events at the origin of the elements up to iron. I shall then illustrate the whole process of studying the origin of one element by focussing on the case of oxygen. I shall remind the first ideas about the nuclear processes involved, the astrophysical sites, how this knowledge can be used to make models for the chemical evolution of galaxies and how the predictions of these models can be compared with observational constraints. I shall conclude by describing a present-day highly debated question concerning this element: what is the abundance of oxygen in the Sun?