Mucopolysaccharidosis III (MPS III) has four forms (A–D) that result from buildup of an improperly degraded glycosaminoglycan in lysosomes. MPS IIIB is attributable to the decreased activity of a lysosomal α-N-acetylglucosaminidase (NAGLU). Here, we describe the structure, catalytic mechanism, and inhibition of CpGH89 from Clostridium perfringens, a close bacterial homolog of NAGLU. The structure enables the generation of a homology model of NAGLU, an enzyme that has resisted structural studies despite having been studied for >20 years. This model reveals which mutations giving rise to MPS IIIB map to the active site and which map to regions distant from the active site. The identification of potent inhibitors of CpGH89 and the structures of these inhibitors in complex with the enzyme suggest small-molecule candidates for use as chemical chaperones. These studies therefore illuminate the genetic basis of MPS IIIB, provide a clear biochemical rationale for the necessary sequential action of heparan-degrading enzymes, and open the door to the design and optimization of chemical chaperones for treating MPS IIIB.