Cytochrome P450 17A1 (CYP17A1) catalyzes C17 hydroxylation of pregnenolone and progesterone and the subsequent C17–C20 bond cleavage (lyase reaction) to form androgen precursors. Compound I (Cpd I) and peroxo anion (POA) are the heme-reactive species underlying the two reactions. We have characterized the reaction path for both the hydroxylase and lyase reactions using density functional theory (DFT) calculations and the enzyme–substrate interactions by molecular dynamics (MD) simulations. Activation barriers for positions subject to hydroxylase reaction have values close to each other and span from 54 to 60 kJ·mol–1 with a small preference for 17α hydroxylation, in agreement with experimental observations. For the lyase reaction, two different types of mechanisms, concerted and stepwise, with identical activation energies (87 kJ·mol–1) were identified. Embedding the DFT-optimized transition states (TSs) for the two reactions into the active site of CYP17A1 showed that the TS for the C17 hydroxylation needs to be distorted by 13 kJ·mol–1, whereas the TS for the 17,20 lyase reaction easily can be accommodated in the protein. Finally, differences in the hydrogen-bond pattern of the substrates were detected both in the CYP17A1–Cpd I and CYP17A1–POA complexes, with the former found to be more pivotal for the hydroxylation site than the latter, suggesting a possible explanation for the slower conversion of CYP17A1 for 17α-hydroxyprogesterone over 17α-hydroxypregnenolone. The results support the concept that the selectivity of the steroidogenic CYPs is ruled by direct interactions with the enzyme, in contrast to the selectivity of drug-metabolizing CYPs, where the reactivity of the substrates dominates.