Pneumonia is one of the main reasons why young children die around the world, so it's essential to detect it early and make sure the methods used are straightforward to understand for doctors. This study aims to analyze and compare pneumonia detection systems based on Explainable Artificial Intelligence (XAI), implemented through the Gradient-weighted Class Activation Mapping (Grad-CAM) technique applied to four Convolutional Neural Network (CNN) architectures: VGG16, DenseNet, MobileNet, and EfficientNet-B0. The dataset used consists of approximately 5,800 chest X-ray images from Kaggle, split into training, validation, and test sets. The dataset underwent preprocessing, augmentation, and filtering. Each model was trained and tested using the accuracy, precision, recall, and F1-score measures. Additionally, the models were analyzed for explainability using Grad-CAM heatmaps. The results showed that MobileNet achieved the highest classification performance, attaining 99.6% accuracy, precision, recall, and F1-score, while EfficientNet-B0 demonstrated the highest explainability in a visual evaluation by medical practitioners. Explainability was assessed through a survey distributed to four medical professionals —two radiologists, a general practitioner, and a radiology technologist —using a Likert scale (1–5) to rate aspects such as focus accuracy, heatmap clarity, consistency of the area, and interpretability. EfficientNet-B0 achieved the highest average explainability score of 41.50, followed by MobileNet at 40.50. Thus, MobileNet is recommended for accuracy, while EfficientNet-B0 is the best choice if visual interpretability is a priority. This research underscores the importance of integrating explainability into the development of AI-based disease detection systems to enhance trust and safety in clinical applications.