Healthcare data analysis has become essential after epidemic outbreaks. The manual examination of medical images such as X-rays and computed tomography (CT) scans became one of these challenges. This paper introduces a healthcare architecture that tackles the analysis efficiency and accuracy challenges by harnessing artificial intelligence (AI) capabilities. This architecture utilizes fog computing and presents a modified convolutional neural network (CNN) designed specifically for image analysis. Different architectures of CNN layers are thoroughly explored and evaluated to optimize overall performance. To demonstrate the effectiveness of the proposed approach, a dataset of X-ray images is utilized for analysis and evaluation. Comparative assessments are conducted against recent models such as VGG16, VGG19, MobileNet, and related research papers. Notably, the proposed approach achieves an exceptional accuracy rate of 99.88% in classifying normal cases, accompanied by a validation rate of 96.5%, precision and recall rates of 100%, and an F1 score of 100%. These results highlight the immense potential of fog computing and modified CNNs in revolutionizing healthcare image analysis and diagnosis, not only during pandemics but also in the future. By leveraging these technologies, healthcare professionals can improve the efficacy and accuracy of medical image analysis, leading to improved patient care and outcomes.