There are many different kinds of fungi, living in many different kinds of environments, filling different ecological niches. To lump them all together as being the same is like comparing a giraffe to a carrot.
Saprophytic fungi eat only dead matter. Without these kinds of fungi,
wood and leaves would never break down.
Mycorrhizal fungi live on the roots of plants and supply plants with nutrients in exchange for different nutrients. Some of these fungi live on the roots, some of them actually live
inside the roots. Recent research suggests that the majority of green plants exist symbiotically with fungal allies, in much the same way bacteria live inside human beings.
Fungal pathogens that attack crops are highly specialized. Each pathogen typically only attacks a particular kind of plant. If a fungal pathogen becomes a problem, it might be because one is growing too much of a particular kind of crop, or because one is not rotating annual crops enough. The loss of beneficial fungi by farming methods such as tilling and synthetic fertilization may encourage the growth of disease causing organisms. (Like how taking antibiotics kills the good bacteria in the human intestine, allowing bad bacteria to bloom and cause sickness.)