The GI tract can develop some medical issues that may require a doctor to evaluate them. These consist of growth anomalies, tissue inflammations, and gastrointestinal issues. In this work, we propose a novel deep-learning (DL) technique to classify the categories of Gastrointestinal Diseases from Wireless Capsule Endoscopy (WCE) images. It has five steps to evaluate. Initially, utilizing the mean filter to remove the noise from given input images. Then extract the features such as shape and position from wireless capsule endoscopy images using the DenseNet-121 technique. To select the features, we utilize the Enhanced Whale Optimization Algorithm (EWOA). Finally, to classify the eight classes of gastrointestinal diseases, we propose a SE-ResNet technique to classify the GI diseases into Ulcerative-colitis, Normal-cecum, Dyed-resection-margins, Esophagitis, Normal-pylorus, Dyed-lifted-polyps, Normal-z-line, Polyps categories with Bald Eagle Search optimization technique to get better accuracy of classification outcomes. In our experiments, we used the Kvasir v2 dataset, and the experiments performed well in terms of recall, precision, accuracy, and f1-score. The performance of the classification technique achieves 99.66% accuracy. The proposed method detects GI disorders on WCE images better than "state-of-the-art" methods while also classifying the items.