Recently, various methods have been developed to identify COVID-19 cases, such as PCR testing and non-contact procedures such as chest X-rays and computed tomography (CT) scans. Deep learning (DL) and artificial intelligence (AI) are critical tools for early and accurate detection of COVID-19. This research explores the different DL techniques for identifying COVID-19 and pneumonia on medical CT and radiography images using ResNet152, VGG16, ResNet50, and DenseNet121. The ResNet framework uses CT scan images with accuracy and precision. This research automates optimum model architecture and training parameters. Transfer learning approaches are also employed to solve content gaps and shorten training duration. An upgraded VGG16 deep transfer learning architecture is applied to perform multi-class classification for X-ray imaging tasks. Enhanced VGG16 has been proven to recognize three types of radiographic images with 99% accuracy, typical for COVID-19 and pneumonia. The validity and performance metrics of the proposed model were validated using publicly available X-ray and CT scan data sets. The suggested model outperforms competing approaches in diagnosing COVID-19 and pneumonia. The primary outcomes of this research result in an average F-score (95%, 97%). In the event of healthy viral infections, this research is more efficient than existing methodologies for coronavirus detection. The created model is appropriate for recognition and classification pre-training. The suggested model outperforms traditional strategies for multi-class categorization of various illnesses.