Autophagy is an evolutionarily conserved intracellular system that maintains cellular homeostasis by degrading and recycling damaged cellular components. The transcription factor HLH-30/TFEB-mediated autophagy has been reported to regulate tolerance to bacterial infection, but less is known about the bona fide bacterial effector that activates HLH-30 and autophagy. Here, we unveil that bacterial membrane pore-forming toxin (PFT) induces autophagy in an HLH-30-dependent manner in Caenorhabditis elegans. Moreover, autophagy controls the susceptibility of animals to PFT toxicity through xenophagic degradation of PFT and repair of membrane-pore cell-autonomously in the PFT-targeted intestinal cells in C. elegans. These results demonstrate that autophagic pathways and autophagy are induced partly at the transcriptional level through HLH-30 activation and are required to protect metazoan upon PFT intoxication. Together, our data show a new and powerful connection between HLH-30-mediated autophagy and epithelium intrinsic cellular defense against the single most common mode of bacterial attack in vivo.