A notable characteristic of fungal genomes is that genes involved in successive steps of a metabolic pathway are often physically linked or clustered. To investigate how such clusters of functionally related genes are assembled and maintained, we examined the evolution of gene sequences and order in the galactose utilization (GAL) pathway in whole-genome data from 80 diverse fungi. We found that GAL gene clusters originated independently and by different mechanisms in three unrelated yeast lineages. Specifically, the GAL cluster found in Saccharomyces and Candida yeasts originated through the relocation of native unclustered genes, whereas the GAL cluster of Schizosaccharomyces yeasts was acquired through horizontal gene transfer from a Candida yeast. In contrast, the GAL cluster of Cryptococcus yeasts was assembled independently from the Saccharomyces/Candida and Schizosaccharomyces GAL clusters and coexists in the Cryptococcus genome with unclustered GAL paralogs. These independently evolved GAL clusters represent a striking example of analogy at the genomic level. We also found that species with GAL clusters exhibited significantly higher rates of GAL pathway loss than species with unclustered GAL genes. These results suggest that clustering of metabolic genes might facilitate fungal adaptation to changing environments both through the acquisition and loss of metabolic capacities.