Macroautophagy/autophagy is a conserved catabolic process through which cellular excessive or dysfunctional proteins and organelles are transported to the lysosome for terminal degradation and recycling. Over the past few years increasing evidence has suggested that autophagy is not only a simple metabolite recycling mechanism, but also plays a critical role in the removal of intracellular pathogens such as bacteria and viruses. When autophagy engulfs intracellular pathogens, the pathway is called 'xenophagy' because it leads to the elimination of foreign microbes. Recent studies support the idea that xenophagy can be modulated by bacterial infection. Meanwhile, convincing evidence indicates that xenophagy may be involved in malignant transformation and cancer therapy. Xenophagy can suppress tumorigenesis, particularly during the early stages of tumor initiation. However, in established tumors, xenophagy may also function as a prosurvival pathway in response to microenvironment stresses including bacterial infection. Therefore, bacterial infection-related xenophagy may have an effect on tumor initiation and cancer treatment. However, the role and machinery of bacterial infection-related xenophagy in cancer remain elusive. Here we will discuss recent developments in our understanding of xenophagic mechanisms targeting bacteria, and how they contribute to tumor initiation and anticancer therapy. A better understanding of the role of xenophagy in bacterial infection and cancer will hopefully provide insight into the design of novel and effective therapies for cancer prevention and treatment.