ABSTRACTEnergy efficiency and secure data transmission are considered as the main design targets of wireless sensor network (WSN). Previous energy‐aware cluster head (CH) selection approaches could not provide secured data transmission. To address this problem, a self‐attention–based cycle‐consistent generative adversarial network (SaCyCsGAN) with honey badger algorithm (HyBA)–adopted energy‐aware routing (EgAR) in WSN is proposed. Initially, the proposed system uses a CH to carry out the routing practice. Accordingly, SaCyCsGAN classifier is exploited for CH selection under firm fitness function: delay, distance, energy, cluster density, and traffic rate. Afterward CH selection, a spiteful node may enter the cluster and acts as a CH. Hence, best path selection is needed. For that, HyBA is utilized, it selects the best path depending upon triplet parameter: trust, connectivity, and service degree. Finally, data are conveying into base station (BS) and vice versa under best path. Finally, the proposed EgAR‐WSN‐SaCyCsGAN‐HyBA method attains 24.13%, 28.57%, 5.88%, and 20.37% higher throughput and 18.50%, 21.67%, 13.33%, and 22.22% lesser energy consumption evaluated to the existing methods such as multiple‐objective CH utilizing self‐attention basis progressive generative adversarial network for safe data aggregation (EgAR‐WSN‐SAPrGAN‐ArVOA), reinforcement learning–based energy‐efficient optimized routing protocol in WSN (EgAR‐WSN‐RLGT‐BCSA), data aggregation including clustering protocol in WSN under machine learning (EgAR‐WSN‐AfNN), and optimum cluster along trusted path for routing formation with categorization of intrusion under machine learning categorization (EgAR‐WSN‐RsBPDT‐HoCSOA).