Altitude and stand density are important factors affecting biodiversity, but the compound effects and pathways of altitude and stand density affecting understory plant diversity in tropical rainforests are largely unknown. In this study, we set up 32 plots based on elevation and stand density gradients in tropical rainforests located in Hainan Island, China. We surveyed plant species diversity in each plot and analyzed the influence of altitude and stand density on understory plant diversity (species richness, Shannon diversity index, Simpson dominance index, and species evenness). The pathways by which altitude and stand density affect understory plant diversity directly or indirectly through overstory plant diversity and environmental factors (canopy closure, litter, soil C/N, soil N/P, and soil pH) were explored. The results showed that altitude had limited effect on understory species richness, Simpson dominance index, and species evenness, but significantly reduced Shannon diversity index indirectly via overstory Shannon diversity and canopy density. Compared with altitude, increases of stand density significantly reduced the understory species richness, directly and indirectly by increasing canopy density and soil N/P. Our results highlight the difference in the effects of altitude and stand density on understory plant diversity, and show that canopy density is an important factor for the combined effects on understory plant diversity. Our findings deepen the understanding of the formation mechanism of understory plant diversity in tropical rainforests.