Recently, deep learning and the Internet of Things (IoT) have been widely used in the healthcare monitoring system for decision making. Disease prediction is one of the emerging applications in current practices. In the method described in this paper, lung cancer prediction is implemented using deep learning and IoT, which is a challenging task in computer-aided diagnosis (CAD). Because lung cancer is a dangerous medical disease that must be identified at a higher detection rate, disease-related information is obtained from IoT medical devices and transmitted to the server. The medical data are then processed and classified into two categories, benign and malignant, using a multi-layer CNN (ML-CNN) model. In addition, a particle swarm optimization method is used to improve the learning ability (loss and accuracy). This step uses medical data (CT scan and sensor information) based on the Internet of Medical Things (IoMT). For this purpose, sensor information and image information from IoMT devices and sensors are gathered, and then classification actions are taken. The performance of the proposed technique is compared with well-known existing methods, such as the Support Vector Machine (SVM), probabilistic neural network (PNN), and conventional CNN, in terms of accuracy, precision, sensitivity, specificity, F-score, and computation time. For this purpose, two lung datasets were tested to evaluate the performance: Lung Image Database Consortium (LIDC) and Linear Imaging and Self-Scanning Sensor (LISS) datasets. Compared to alternative methods, the trial outcomes showed that the suggested technique has the potential to help the radiologist make an accurate and efficient early lung cancer diagnosis. The performance of the proposed ML-CNN was analyzed using Python, where the accuracy (2.5–10.5%) was high when compared to the number of instances, precision (2.3–9.5%) was high when compared to the number of instances, sensitivity (2.4–12.5%) was high when compared to several instances, the F-score (2–30%) was high when compared to the number of cases, the error rate (0.7–11.5%) was low compared to the number of cases, and the computation time (170 ms to 400 ms) was low compared to how many cases were computed for the proposed work, including previous known methods. The proposed ML-CNN architecture shows that this technique outperforms previous works.