The rational development of specific inhibitors for the approximately 500 protein kinases encoded in the human genome is impeded by a poor understanding of the structural basis for the activity and selectivity of small molecules that compete for ATP binding. Combining classical dynamic simulations with a novel ab initio computational approach linear-scalable to molecular interactions involving thousands of atoms, we have investigated the binding of five distinct inhibitors to the cyclin-dependent kinase CDK2. We report here that polarization and dynamic hydrogen bonding effects, so far undetected by crystallography, affect both their activity and selectivity. The effects arise from the specific solvation patterns of water molecules in the ATP binding pocket or the intermittent formation of hydrogen bonds during the dynamics of CDK/inhibitor interactions and explain the unexpectedly high potency of certain inhibitors such as 3-(3H-imidazol-4-ylmethylene)-5-methoxy-1,3-dihydro-indol-2-one (SU9516). The Lys89 residue in the ATP-binding pocket of CDK2 is observed to form temporary hydrogen bonds with the three most potent inhibitors. This residue is replaced in CDK4 by Thr89, whose shorter side-chain cannot form similar bonds, explaining the relative selectivity of the inhibitors for CDK2. Our results provide a generally applicable computational method for the analysis of biomolecular structures and reveal hitherto unrecognized features of the interaction between protein kinases and their inhibitors.