In the Internet of Things (IoT) based system, the multi-level client's requirements can be fulfilled by incorporating communication technologies with distributed homogeneous networks called ubiquitous computing systems (UCS). The UCS necessitates heterogeneity, management level, and data transmission for distributed users. Simultaneously, security remains a major issue in the IoT-driven UCS. Besides, energy-limited IoT devices need an effective clustering strategy for optimal energy utilization. The recent developments of explainable artificial intelligence (XAI) concepts can be employed to effectively design intrusion detection systems (IDS) for accomplishing security in UCS. In this view, this study designs a novel Blockchain with Explainable Artificial Intelligence Driven Intrusion Detection for IoT Driven Ubiquitous Computing System (BXAI-IDCUCS) model. The major intention of the BXAI-IDCUCS model is to accomplish energy efficacy and security in the IoT environment. The BXAI-IDCUCS model initially clusters the IoT nodes using an energy-aware duck swarm optimization (EADSO) algorithm to accomplish this. Besides, deep neural network (DNN) is employed for detecting and classifying intrusions in the IoT network. Lastly, blockchain technology is exploited for secure inter-cluster data transmission processes. To ensure the productive performance of the BXAI-IDCUCS model, a comprehensive experimentation study is applied, and the outcomes are assessed under different aspects. The comparison study emphasized the superiority of the BXAI-IDCUCS model over the current state-of-the-art approaches with a packet delivery ratio of 99.29%, a packet loss rate of 0.71%, a throughput of 92.95 Mbps, energy consumption of 0.0891 mJ, a lifetime of 3529 rounds, and accuracy of 99.38%.