The opioid crisis has escalated during the COVID-19 pandemic. More than half of the overdose-related deaths are related to synthetic opioids represented by fentanyl which is a potent agonist of mu-opioid receptor (mOR). In recent years, crystal structures of mOR complexed with morphine derivatives have been determined; however, structural basis of mOR activation by fentanyl-like synthetic opioids remains lacking. Exploiting the X-ray structure of mOR bound to a morphinan ligand and several state-of-the-art simulation techniques, including weighted ensemble and continuous constant pH molecular dynamics, we elucidated the detailed binding mechanism of fentanyl with mOR. Surprisingly, in addition to the orthosteric site common to morphinan opiates, fentanyl can move deeper and bind mOR through hydrogen bonding with a conserved histidine H297, which has been shown to modulate mOR's ligand affinity and pH dependence in mutagenesis experiments, but its precise role remains unclear. Intriguingly, the secondary binding mode is only accessible when H297 adopts a neutral HID tautomer. Alternative binding modes and involvement of tautomer states may represent general mechanisms in G protein-coupled receptor (GPCR)-ligand recognition. Our work provides a starting point for understanding mOR activation by fentanyl analogs that are emerging at a rapid pace and assisting the design of safer analgesics to combat the opioid crisis. Current protein simulation studies employ standard protonation and tautomer states; our work demonstrates the need to move beyond the practice to advance our understanding of protein-ligand recognition.