Accurately predicting the fatigue life of long-distance natural gas pipelines with internal corrosion defects is essential to ensure structural integrity and operational safety. While data-driven models offer potential in this regard, many lack interpretability. To address this, we propose a novel, interpretable machine learning framework that combines an Extreme Gradient Boosting (XGBoost, v3.0.3) model, optimized via Particle Swarm Optimization (PSO), with SHapley Additive exPlanations (SHAP) based post hoc interpretation. A dataset of 510 samples was generated through FE simulations, incorporating realistic pipe geometry, material properties, and statistically representative corrosion defect parameters. The optimized PSO-XGBoost model demonstrated exceptional predictive performance on the test set, with a coefficient of determination (R2) of 0.9921, and a Mean Absolute Error (MAE) of 2.7491 years, significantly outperforming benchmark models. Crucially, the SHAP analysis provided global and local interpretations, revealing that the defect width coefficient (k3) and pipe diameter (D) are the most influential features, while operational pressure (P) had a minimized impact due to multicollinearity handling. The research findings can provide a basis for pipeline risk assessment and integrity management.