Nodes are deployed randomly in the network area of the WSN. data transmission from source to destination via intermediate nodes should be done in a secure fashion. Due to the large size of packet loss and energy consumption of sensor nodes, a secure and energy-efficient path must be required. The main objective of this research is to provide secure data transmission among node-to-node for efficient delivery of data packets to the destination. The system uses a novel hybrid firefly and BAT algorithm for path selection, an innovative trust value generation, and optimal neighborhood selection using fuzzy logic. The research employs Elliptic Curve Cryptography (ECC) combined with Diffie-Hellman exchange for key generation and key exchange. Path selection is done by fuzzy logic and optimization of selection has been carried out by hybrid BAT and Firefly algorithms. Key generation includes a time-based randomness factor that increases the complexity of cryptanalysis, thereby providing the most security. The performance of the simulation is analyzed and depicted in terms of delay, throughput, energy, and processing time. The research has been carried out using a network simulator with nodes deployed randomly in the network area with mobility as the primary concern that requires dynamic path selection.