Danjiangkou Reservoir is a critical water source for the South-to-North Water Diversion Project, which harbors a diverse bacterioplankton community with varying depths, and the understanding of its nitrogen and phosphorus cycle and associated driving factors remains limited. In this study, we selected five ecological sites within Danjiangkou Reservoir and conducted metagenomics analysis to investigate the vertical distribution of bacterioplankton communities in the surface, middle, and bottom layers. Furthermore, we analyzed and predicted the function of nitrogen and phosphorus cycles, along with their driving factors. Our findings revealed the dominance of Proteobacteria, Actinobacteria, and Planctomycetes in the Danjiangkou Reservoir. Significant differences were observed in the structure of bacterioplankton communities across different depths, with temperature (T), oxidation-reduction potential (ORP), dissolved oxygen (DO), and Chla identified as primary factors influencing the bacterioplankton composition. Analysis of nitrogen cycle functional genes identified 39 genes, including gltB, glnA, gltD, gdhA, NRT, etc., which were involved in seven main pathways, encompassing nitrogen fixation, nitrification, denitrification, and dissimilatory nitrate reduction. Phosphorus cycle function gene analysis identified 54 genes, including pstS, ppx-gppA, glpQ, ppk1, etc., primarily participating in six main pathways, including organic P mineralization, inorganic P solubilization, and regulatory. Cluster analysis indicated that different depths were significant factors influencing the composition and abundance of nitrogen and phosphorus cycle functional genes. The composition and abundance of nitrogen and phosphorus cycle functional genes in the surface and bottom layers differed and were generally higher than those in the middle layer. Deinococcus, Hydrogenophaga, Limnohabitans, Clavibacter, and others were identified as key species involved in the nitrogen and phosphorus cycle. Additionally, we found significant correlations between nitrogen and phosphorus cycle functional genes and environmental factors such as DO, pH, T, total dissolved solids (TDS), electrical conductivity (EC), and Chla. Furthermore, the content of these environmental factors exhibited depth-related changes in the Danjiangkou Reservoir, resulting in a distinct vertical distribution pattern of bacterioplankton nitrogen and phosphorus cycle functional genes. Overall, this study sheds light on the composition, function, and influencing factors of bacterioplankton communities across different layers of Danjiangkou Reservoir, offering valuable insights for the ecological function and diversity protection of bacterioplankton in this crucial reservoir ecosystem.