We develop a machine learning algorithm to extract the mechanism of transitions between metastable states from molecular dynamics simulations. Our algorithm combines transition path sampling (TPS), deep learning, and statistical inference to simulate the dynamics of complex molecular reorganizations. We iteratively train a deep learning model on the outcomes of the shooting moves used in TPS. By learning to predict the transition dynamics, the artificial intelligence (AI) system at the center of the algorithm gradually reveals the underlying mechanism of the transition dynamics, and at the same time increases the efficiency of the rare-event sampling. The AI system can simultaneously learn from and guide multiple TPS simulations running in parallel. In a second step, we then distill the knowledge about the transition mechanism encoded in the deep learning model into a reduced mathematical model. The reduced model concisely represents the key features of the mechanism in an explicit analytical, human-understandable form. We apply the algorithm to molecular systems ranging from ion dissociation in aqueous solution over gas hydrate formation to the oligomerization of a transmembrane alpha helix involved in membrane sensing. In all cases, the AI system accurately predicts the transition dynamics and extracts reduced mathematical models of the underlying mechanisms.