As organic material slowly decomposes in a landfill, it generates methane gas. While methane is captured and used to make electricity at the landfill, over 50% of the methane escapes into the environment. Methane is a powerful greenhouse gas - 25 times worse for the environment than the carbon dioxide emissions from cars and coal fired power plants. Organics collection and processing through an anaerobic digester or composter keeps this harmful gas from the atmosphere and actually puts it to good use.
Organic materials are high in moisture content. This moisture travels through the landfill picking up chemicals and toxins from the other materials buried there. This harmful stew is called leachate. Landfills have leachate collection systems, and modern landfills to their best to prevent blockages and prevent damage to liners that protect the leachate from entering groundwater - however, as with all questions regarding waste, preventing the creation of waste or leachate is always better than trying to treat the problem afterwards.
When organic material is placed into a landfill, we waste a valuable resource. Organic material like food scraps is rich with nutrients. Both composting and anaerobic digestion creates a solid material that contains the valuable nutrients that were present in the organic material. When farmers and backyard gardeners use that compost, they are returning those nutrients to the soil to be utilized.
Organic material can also be a renewable energy source. As discussed earlier, when this material decomposes in an oxygen free environment (like in a pile at a landfill) it creates methane. At an anaerobic digester, they can use methane to power generators that produce electricity, or they collect the gas for injection into an RNG facility where the gas can be used to power vehicles. As part of the digestion process, the excess heat generated can be used to warm buildings.
At a composter, methane should not develop if the material is handled appropriately and kept well aerated.
In short, instead of taking organic material that we no longer want or need and burying it in a landfill, we can take it, process it, and produce valuable renewable resources. Rather than asking why we do this, perhaps a better question would be to ask why we haven't been doing this all along.