This study used vertical and horizontal subsurface constructed wetlands with continuous inflow, to compare and analyze the effects of four hydraulic residence times on the removal efficiency of conventional pollutants. Using the optimal hydraulic retention time, the two types of wetlands were examined in terms of the stromal layer nitrification, denitrification, and ammonia oxidation abundance of functional genes, as well as the intensity of nitrification and denitrification. In addition, redundancy analysis and variance decomposition analysis were used to determine the main factors affecting nitrogen removal in the two kinds of wetlands, so that targeted improvement measures can be suggested. The best removal efficiency of conventional pollutants (COD, TP, TN, and NH4+-N) was achieved with a hydraulic retention time of 24 h, resulting in a removal rate of more than 70%. With a 24 h retention time, the removal rate of NH4+-N and TN and the intensity of nitrification and denitrification exhibited a gradually decreasing trend along the flow direction. Among the three functional genes, the abundance of denitrification functional genes (nirS) was much higher than that of nitrification functional genes (nxrA) and ammonia oxidation functional genes (AOB-amoA). In this study, the nitrogen removal ability of the two subsurface flow constructed wetlands was jointly affected by environmental factors and microbial factors, among which microbial factors contributed the most to nitrogen removal (55% and 48%). In addition, the removal rates of TN and NH4+-N were proportional to DO, specific surface area of substrate, COD concentration, as well as nitrification and denitrification functional genes, but inversely proportional to pH. Therefore, in order to improve the nitrogen removal efficiency of both systems, the amount of dissolved oxygen and carbon sources in the substrate layer should be increased, while the pH value should be appropriately reduced. Moreover, the horizontal subsurface constructed wetland significantly improves the nitrogen removal efficiency of the system, as the substrate layer has a larger specific surface area. This study provides a theoretical basis for the design of constructed wetlands and the selection of an optimal hydraulic residence time. Quantitative analysis of nitrogen removal pathways is of great significance for understanding the nitrogen removal mechanism and improving the nitrogen removal rate in constructed wetlands.