Deep learning (DL) approaches provide predictive analysis capabilities for heart-related diseases (HRD), enabling early pattern detection and identification of associated risk factors. Additionally, nature-inspired algorithms have demonstrated their efficacy in optimizing complex problems, including risk prediction, treatment planning, and resource allocation in disease management. Therefore, this paper proposes a hybrid approach that combines DL methods with a nature-inspired algorithm. In this paper, the Crow Search Optimization Algorithm (CSOA) is integrated with DL techniques for HRD classification. The classification was performed using deep neural network (DNN) and convolutional neural network (CNN) algorithms. The experiments were conducted on two datasets: the Cardio dataset, containing numeric HRD data, and the NIH chest X-ray image dataset, comprising HRD-related X-ray images. Several optimizers, such as Stochastic Gradient Descent with Momentum, RMSProp, Adam, Adagrad, Follow the Regularized Leader, and Nadam, were evaluated for the classification task. Importantly, the combination of CSOA with DNN (CSOA-DNN) significantly enhances the performance of the DNN model on the Cardio dataset. Overall, the Adam and Nadam optimizers consistently outperform other optimizers across various performance parameters during both training and validation. Using the Adam optimizer, the classification accuracy reaches 96.6% (trained AR) and 92.2% (validation AR), with precision (PS) at 91%, recall (RL) at 95.5%, and F-score (FS) at 93.2%. Similarly, the Nadam optimizer achieves comparable results, with accuracy at 96.5% (trained AR) and 93.3% (validation AR), precision at 91.7%, recall at 95.7%, and F-score at 93.7%. These findings underscore the superior performance of the Adam and Nadam optimizers across various performance parameters in both DNN and CNN models. The incorporation of CSOA notably enhances the performance of the DNN model, leading to improved classification accuracy and other performance measures.