Carbons are the energy source for your compost. It gets the breakdown started. If you don’t have enough of these then the compost just becomes a sticky rotten mess.
Nitrogens help to provide food for the bacteria to help break it down.
When these two elements come together, along with sunlight, water, and oxygen, a chemical process happens and the organic matter is broken down into soil.