The gut tissue interacts with nutrients and pollutants which can impact gut health. Gut microbiota is essential to the host health, but is also easily affected by external environment. However, little is known about the toxicological assessment of environmental contaminants on gut health and microbiota, especially in marine invertebrates. In this study, we first explored the effect of benzo(a)pyrene (BaP) on the gut health and gut microbiota of scallops (Chlamys farreri). The scallops were exposed to different concentrations (0, 0.4, 2 and 10 μg/L) of BaP for 21 days. The histological morphology, immune- and oxidative enzyme-related gene expression, and lipid peroxidation of the scallops were analyzed at 7, 14 and 21 days. The results revealed that BaP could impair intestinal barrier function, increasing the intestinal permeability of scallops. Moreover, immune and antioxidant responses were induced in the gut tissue. After a 21-day exposure to different concentrations of BaP, the intestinal microbial community was analyzed based on 16S rRNA sequencing. Our results suggested that BaP exposure altered the gut microbial diversity and composition in scallops. Many beneficial genera declined after BaP treatment, while the potential pathogens were increased, such as Mycoplasma and Tenacibaculum. A series of hydrocarbon-degrading bacteria were recognized in BaP-treated groups, such as Pseudomonas, Polaribacter, Amphritea and Kordiimonas. Interestingly, the degrading bacteria present varied after exposure to different concentrations of BaP. Overall, this study provides new insights into gut health and gut microbiota in marine invertebrates following exposure to persistent organic pollutants.