Ventilator-associated pneumonia is the leading cause of death in intensive care units (ICU). Hospital-acquired pneumonia is twice as common in non-ventilated patients as it is in ventilated patients, according to a recent study. Exhaled breath samples can be used to distinguish between ill and healthy individuals by identifying volatile organic compounds (VOCs) in the breath. A reliable and non-invasive method of diagnosing VOC-induced pneumonia is essential for prompt treatment and decreasing fatality rates. Researchers have used wearable biosensors and machine learning (ML) algorithms to diagnose pneumonia to analyze VOCs in exhaled air. Wireless body area networks (WBANs) offer the potential for wearable sensors and internet-enabled ICU monitoring when it comes to health monitoring. These results imply that a wearable biosensor-based IoT-based machine learning system may identify ventilator- and hospital-acquired pneumonia from exhaled VOC components. The developed device was deployed on an NVIDIA Jetson Nano graphical processing unit, allowing for the seamless and immediate transmission of volatile organic compound (VOC) data and other patient biological attributes such as temperature and blood oxygen saturation (SpO2) to the Amazon Web Services IoT Core. VOC and ML-aided techniques have proven that artificial intelligence can reliably discriminate pneumonia samples from control samples, and the SVM model outperforms the K Nearest Neighbors model in terms of accuracy (91.38%), sensitivity (92.7%), precision (92.8%), and receiver operating characteristic (ROC) (91.01 percent).