Genome mining of one of the protective symbionts (Burkholderia gladioli) of the invasive beetle Lagria villosa revealed a cryptic gene cluster that codes for the biosynthesis of a novel antifungal polyketide with a glutarimide pharmacophore. Targeted gene inactivation, metabolic profiling, and bioassays led to the discovery of the gladiofungins as previously-overlooked components of the antimicrobial armory of the beetle symbiont, which are highly active against the entomopathogenic fungus Purpureocillium lilacinum. By mutational analyses, isotope labeling, and computational analyses of the modular polyketide synthase, we found that the rare butenolide moiety of gladiofungins derives from an unprecedented polyketide chain termination reaction involving a glycerol-derived C3 building block. The key role of an Afactor synthase (AfsA)-like offloading domain was corroborated by CRISPR-Cas-mediated gene editing, which facilitated precise excision within a PKS domain.