Pneumonia continues to be a major global health burden, with disproportionately high mortality among children under five years of age and elderly populations. Timely and accurate diagnosis is essential for effective clinical intervention; however, conventional chest X-ray interpretation is highly dependent on radiologist expertise, prone to inter-observer variability, and often limited by workforce shortages in resource-constrained settings. To address these challenges, this study proposes an attention-enhanced and uncertainty-aware deepLearning framework for automated pneumonia detection from chest X-ray images.The proposed approach integrates multiple CNN architectures, including a custom-designed model and transfer learning–based networks built upon VGG16, ResNet50, and DenseNet121. To improve feature discrimination and localization of pathological regions, an attention mechanism is incorporated into the learning pipeline, enabling the models to focus on clinically relevant lung regions. Furthermore, an uncertainty-aware inference strategy based on Monte Carlo Dropout is employed to quantify predictive confidence, enhancing the reliability and clinical safety of the system. An ensemble learning strategy is then applied to combine complementary model predictions and improve overall diagnostic robustness.Experimental results demonstrate that the proposed ensemble model achieves an accuracy of 96.84%, sensitivity of 97.23%, specificity of 96.45%, and an F1-score of 96.91%, with an AUC-ROC of 0.9889, outperforming existing state-of-the-art approaches. Model interpretability is enhanced through gradient Grad-CAM and attention visualization, providing transparent insights into decision-making regions within chest X-rays. The system achieves an average inference time of 0.087 seconds per image, supporting real-time clinical deployment.Overall, the findings indicate that attention-guided and uncertainty-aware deep learning models can significantly augment radiological decision-making, particularly in settings with limited access to expert radiologists. The proposed framework offers a reliable, interpretable, and computationally efficient solution for pneumonia diagnosis and establishes a scalable foundation for extending AI-based diagnostic systems to other pulmonary diseases.