The recipe for the making of the elements reads like a cookbook. In the first 3 minutes following the universe's fiery birth, very little was produced during big bang nucleosynthesis (BBN) due to some nuclear anomalies; there are no stable mass-5 or mass-8 nuclides making it almost impossible make anything other than 2H, 3He, 4He and 7Li (which is difficult to produce in abundance). Let's see how the light elements were initially synthesised. Firstly, a neutron coalesces with 1H to produce a deutron (2H) and a gamma ray; the deutron acts as a bottleneck for the rest of fusion events. Since a free neutron is highly unstable (half life of ~10 min) it decays into a proton and electron antineutrino; so you end up with around half the neutrons you started off with (which get captured into nuclei). 3He is produced when a proton is captured onto a deutron, which is converted to 4He via either neutron capture or a reaction where the deutron tosses in its neutron to the 3He and gives up its proton. In the another set of reactions, neutron capture by a deutron to produce 3He (a triton) gets converted to a 4He via either proton capture or a reaction in which a deutron gives up its proton and frees a neutron. That's pretty much hat was produced during BBN, aside from the fact that 7Li was made in minuscule amounts via the combination of 4He and 3H (in lows baryon density) or through the fusion of 4He and 3He to produce 7Be which was then fused with an electron neutrino. However, WMAP data seems to agree with theoretical calculations of 2H and 4He but not for 7Li (the prediction for lithium is about three times higher than actually observed). The 'lithium problem' may be addressed by short-lived hypothetical particles called axions which bind to nuclei; assuming it was negatively charged, the axion would reduce the Coulomb barrier between particles as the universe cooled to a certain point, hence triggering a revival of nucleosynthesis. So now that hydrogen, helium and a little bit of lithium were produced via BBN, the rest of the elements from carbon to lead and even as far as thorium and uranium were synthesised by nuclear reactions in stars.
Stellar nucleosynthesis begins with the initial stage of hydrogen burning, where hydrogen is converted to helium. In each of the 3 pp (proton-proton) chains 4 protons undergo fusion to form a 4He nucleus. In the pp-I branch, 6 protons actually go into the chain but only 2 remain in the final reaction with the 4He nucleus (so the net number of protons consumed is 4). The pp-II branch, the final reaction produces 2 4He nuclei, but one of them is put in to restart the chain (net number is 1). While the pp-III branch begins with 7Be (4He nucleus and 3 protons), so the proton that enters the chain makes one net 4He nucleus when 8Be decays. The CNO (carbon/nitrogen/oxygen) cycle is used for hydrogen burning in more massive stars and uses 12C as a catalyst. Next, the triple alpha and alpha processes of helium burning are rather simple; 2 4He are fused to form 8Be, 8Be is fused with 4He to produce 12C and 12C combines with 4He to make 16O. Hoyle discovered a resonance (an excited energy level) in the carbon nucleus of 7.7 MeV, to compensate for the instability of 8Be (which lives for 10^-16 secs). Subsequent nuclear reactions involve silicon burning following oxygen burning; the temperature is high enough so photons can interact with 28Si to make 24Mg and a 4He nucleus. Other photons can interact with 24Mg to make 20Ne and 4He nuclei, moreover, the light 4He nuclei can be captured by other 28Si to make 32S followed by 36Ar (very simplified); so nuclei around nickel and iron are products of silicon burning.
But the picture of nucleosynthesis is not complete without a mechanism for making the elements heavier than iron and nickel. Most of which are produced via the s-process (slow neutron capture) and r-process (rapid neutron capture); the s-process happens during helium burning and makes around half the nuclei heavier than iron. Such a process continues until it encounters the closed shells of the nucleons, which makes it difficult to capture an additional neutron. The s-process peaks in element abundance at barium, lead and strontium but the heaviest element made is 209Bi; attempt to add an another neutron and it undergoes beta decay to 210Po, releasing a 4He nucleus and ending up at 206Pb. The favoured site for the r-process is core-collapse supernovae, as a star cools, the seed nuclei form nuclides all the way up to uranium and plutonium and beyond.