Translation elongation plays a central role in multiple aspects of protein biogenesis, e.g., differential expression, cotranslational folding and secretion. However, our current understanding on the regulatory mechanisms underlying translation elongation dynamics and the functional roles of ribosome stalling in protein synthesis still remains largely limited. Here, we present a deep learning-based framework, called ROSE, to effectively decipher the contextual regulatory code of ribosome stalling and reveal its functional connections to translational control of protein expression from ribosome profiling data. Our validation results on both human and yeast datasets have demonstrated superior performance of ROSE over conventional prediction models. With high prediction accuracy, ROSE provides a precise index to estimate the translation elongation rate at codon resolution. We have demonstrated that ROSE can successfully decode diverse regulatory factors of ribosome stalling, including codon usage bias, tRNA adaptation, codon cooccurrence bias, proline codons, N6-methyladenosine (m6A) modification, mRNA secondary structure and protein-nucleotide binding. In addition, our comprehensive genome-wide in silico studies based on ROSE have revealed notable functional interplay between elongation dynamics and several cotranslational events in protein biogenesis, including protein targeting by the signal recognition particle (SRP) and protein secondary structure formation. Furthermore, our intergenic analysis suggests that the enriched ribosome stalling events at the 5' end of the coding sequences (also referred to as the ramp sequences) can be involved in the modulation of translation efficiency. These findings indicate that ROSE can offer a powerful tool to analyze the large-scale ribosome profiling data and provide novel insights into the landscape of ribosome stalling, which will further expand our understanding on translation elongation dynamics.