Why compost... because it is one of the best amendments you can add to your garden. It makes soil more friable, acts as a slow release fertilizer, retains nutrients, improves drainage, retains moisture, helps balance soil ph, etc. You could go out and buy topsoil, fertilizers, composts, etc. etc. but it's not something you do once and are done forever.
Gardens are a work in progress. You can (in some areas) keep planting over and over and get decent crops- but you're essentially strip mining the nutrients out. It only works for so long and then it starts to show- lower yields, lower resistence to pests/diseases, less vigor, etc.
If you have clay soils (a very fine particulate)- to break it up & add drainage, you add compost. If you have sandy soils (very large grains)- to retain moisture & nutrients, you add compost.
Compost has different sized particulates which helps water drain through the soil, yet it can hold almost it's weight in water too. It creates bigger pockets of air- many plants roots also need air- but it also makes it easier for the plant to set a bigger root system.
In a garden you are looking to build humus (when you think of good soil.. dark, fluffy, friable-able to break apart easily, rich... that's due to humus content- which is made up from decomposed materials.) Variety of materials added to the compost then offers more balance in nutrients.
Things you shouldn't add...
meat & fats & dairy- different microbes & bugs break that down- but a big thing is it attracts a lot of unwanted critters too (crazy exceptions for some things like Pawpaws- where rotting carcasses can be used to attract flies that pollinate their stinky flowers. Or used in Black Soldier fly composting- which if you are looking for a chicken feed suppliment, this may be something to consider.)
use caution adding salty foods
carnivore feces... yes, some diseases like e. coli & salmonella are an issue (with manures in general- which is why timing & composting of these materials need to be handled with a bit more care).. but also parasites and carnivore feces tends to be higher in heavy metals just due to their diet. (manures in general should be well composted- and keep an eye out for some things like medications as they can also have heavy metals. Application timing also is very important.)
diseased plants- the last thing you want to do is give it a free place to hang out and then a ride to a new location. Identify what disease is nailing your plants (if you have an extension office nearby, they often can help if you aren't sure.) Potatoes for one can be a pain. I know some like to just cut up some from the store- but- keep in mind they build up viruses over time that impact yield & health... and some plant diseases can take many many years to starve out of the soil.
No creosote.. wood ashes are fine.. but avoid any of the gunk in the flue which is carcinogenic. (has heavy metals, arsenic, etc.)
~~~~~ From the land of TMI.... ~~~~~~
Many soil amendments are actually made from byproducts from other industries. Bone meal & blood meal.. usually from pigs (it's heated, dried, and pulverized.) Feather meal- by product of poultry processing, feathers are boiled, heat dried, and then pulverized. Fish emulsion.. guts, bones, scales, bycatch fish, etc. are ground up, water added, fermented, heated, bottled up for sale. (Kinda funny when you realize you actually end up paying more for rotted fish guts than you do for the fish fillets.) Municipal biosolids. Yep... processed people poo- found in some bags of compost that sometimes are brazen enough to slap on "organic" and up the price too. (Compost is *not* regulated- so "organic" means carbon based materials.. nothing more.) Shredded wood filler- also added to some bagged compost- great stuff if your goal is sickly looking plants. Mushroom compost.. should be more accurately called *spent* mushroom compost, this is the soil medium after it has been used to grow mushrooms (it's not bad.. it's just not much nitrogen left, but it will add loft to soil and a few trace elements.)
I guess that would be another reason... lol.. I think it is weird to pay someone else to take compostable materials away only to then buy someone else's waste.