The fast improvement of cyberattacks in the area of the Internet of Things (IoT) presents novel safety challenges to zero-day attacks. Intrusion detection systems (IDS) are generally focused on exact attacks to defend the use of IoT. However, the attacks were unidentified, for IDS still signifies tasks and concerns about consumers’ data privacy and safety. Anomaly-detection models are generally based on machine learning (ML) models. Conventional ML-based models have been recognized to have low estimate excellence and recognition rates. DL-based models, particularly convolutional neural networks (CNN) with regularization techniques, direct this problem, offer a superior prediction value with unidentified data, and prevent over-fitting. This manuscript presents a Binary Snake Optimizer with DL-Enabled Zero-Day Attack Detection and Classification (BSODL-ZDADC) method. The objective of the BSODL-ZDADC method is to employ metaheuristics with the DL method for enhanced recognition and classification of zero-day attacks. For data normalization, the BSODL-ZDADC method uses a Z-score normalization approach. To reduce the high dimensionality issue and improve the classification results, the BSODL-ZDADC technique designs a BSO method to choose a set of related features. Besides, the attention-based bidirectional gated recurrent unit (ABi-GRU) method helps recognize zero-day attacks. Since the hyperparameters play a vital part in the classification performance, the BSODL-ZDADC technique employs an improved sparrow search algorithm (ISSA). The experimental validation of the BSODL-ZDADC technique is verified by utilizing the ToN-IoT dataset. The performance validation of the BSODL-ZDADC technique portrayed a superior accuracy value of 98.28% over other models.