Investigating the genetic basis of dietary specialization can provide insights into the evolution of niche breadth. In this study, we used comparative genomics methods to analyze two seasonally avivorous bats (Nyatalus aviator and Ia io) to elucidate the mechanism of adaptation to the expansion of their dietary niche from insectivory to avivory. Our findings revealed that genes related to immunity and lipid metabolism underwent positive selection and convergent evolution among two avivorous bat species. We also found that immune-related genes in avivorous bats are under greater compared to bat species with other diets selective pressure and harbor fewer endogenous retroviral elements in their genomes. We also found that TLR10 is absent in the two avivorous bat species. These findings emphasized the significance of immune-driven adaptive evolution in avivory. Additionally, our results showed that the dietary evolution of avivorous bats is accompanied by convergent evolution associated with the PPAR pathway. Notably, CEPT1, the upstream gene required for the activation of the PPAR pathway, underwent positive selection and convergence, which may have affected lipid metabolism. These findings not only provided comprehensive insights into the adaptive evolution underlying the unique diet of avivorous bats but also offered novel perspectives on the molecular mechanisms underlying ecological niche evolution in a dietary context.