The development of Internet of Things (IoT) networks has made them susceptible to cyber-attacks, and thus, proper Intrusion Detection (ID) is the key to safe communication. Current detection systems are usually characterized by low accuracy, high false alarms, and low capability to learn complex feature relations in heterogeneous IoT traffic, which shows the necessity of a more powerful solution. To tackle these issues, this paper proposed the Capsule Dual-Channel Convolutional Block Attention Neural Network with Carpet Weaver Optimization (CD-CCBANNet-CWO) in terms of detecting intrusions. The information gathered on the TON-IoT dataset is preprocessed with Pearson Correlation Coefficient and MinMax Normalization (PCC-MMN). The processed data is then input into the CD-CCBANNet model, and network weights are optimized using Carpet Weaver Optimization (CWO) to provide better convergence and accuracy. Experimental outcomes prove that the model has a 99.45% accuracy, high recall, precision, and F1-score, and a low error rate of 0.55, which is much better compared to the current methods. To sum up, CD-CCBANNet-CWO is a trustworthy and high-performance ID network.