The widely used nonsteroidal anti-inflammatory drugs block the cyclooxygenase enzymes (COXs) and are clinically used for the treatment of inflammation, pain, and cancers. A selective inhibition of the different isoforms, particularly COX-2, is desirable, and consequently a deeper understanding of the molecular basis of selective inhibition is of great demand. Using an advanced computational technique we have simulated the full dissociation process of a highly potent and selective inhibitor, SC-558, in both COX-1 and COX-2. We have found a previously unreported alternative binding mode in COX-2 explaining the time-dependent inhibition exhibited by this class of inhibitors and consequently their long residence time inside this isoform. Our metadynamics-based approach allows us to illuminate the highly dynamical character of the ligand/protein recognition process, thus explaining a wealth of experimental data and paving the way to an innovative strategy for designing new COX inhibitors with tuned selectivity.