The carbon burning process is a nuclear reaction that happens in the core of massive stars under conditions of tremendous temperature and pressure. Carbon burning only initiates near the end of a star's life. For a star to eventually build up enough pressure in its core to initiate carbon burning, it must must contain at least four solar masses at its birth. The carbon burning only begins after large portions of the star's hydrogen and helium has been burned.
The most abundant element in the universe is hydrogen. So, most stars begin their lifetimes made up mostly of hydrogen. As nuclear fusion ignites in the core of a young star, the hydrogen slowly starts to burn away, its atomic nuclei fused into helium through the p-p chain — in stars the mass of the Sun or less — or the CNO cycle —in more massive stars. This is the nuclear reaction that generates the Sun's heat and light that we see when we step outside every day.
Depending on the size of the star, it burns its nuclear fuel at a different rate. More massive stars have denser and hotter centers and burn their fuel faster. Some of the largest stars deplete most of their hydrogen fuel within only a few million million years, while the Sun is scheduled to continue fusing hydrogen for 4.5 billion years, and the lightest stars will fuse hydrogen for a trillion years. As the helium "ash" builds up, it eventually reaches the critical density to cause helium ignition. The byproducts of the helium burning are carbon and oxygen.
As carbon and oxygen builds up in the core of the star over millions of years of helium burning, eventually a large percentage of the helium is depleted, and the star's core cools down, unable to generate more nuclear power. This cooling down causes the core to contract, further increasing the density and pressure. In stars above about four solar masses, the necessary temperature and density is reached for carbon burning. This heats up the core of the star and it expands to become a red supergiant.
Carbon burning is one of the main reasons why there exist elements heavier than carbon in the universe. The main reaction consists of several components. In one, two carbon nuclei fuse to form a neon atom and a helium atom. Eventually, these break down into sodium and hydrogen, then magnesium and a free neutron. Due to all nuclear processes ongoing simultaneously in the star's core, large amounts of neon, oxygen, and magnesium are produced. The whole carbon burning process only takes about 1000 years.
If the star has between four and eight solar masses of material, it will expel its outer layer as the carbon burning peters out, creating a planetary nebulae and leaving behind a white dwarf core. If it has more than eight solar masses, it will eventually initiate neon burning, the next stage in the evolution of massive stars.