In this study, we aimed to investigate the influence of the built environment (BE) on commuter mode choice using machine learning models in a dense megacity context. We collected 10,150 home-based commuting trips data from Dhaka, Bangladesh. We then utilized three machine learning classifiers to determine the most accurate prediction model for predicting the mode of transportation chosen for commuting in Dhaka. Based on the predictive performance of the classifiers, we identified that the Random Forest (RF) algorithm performed the best. Using the RF model, this study also explored the relative importance of BE factors in predicting commute mode choice, identified nonlinear relationships between the BE factors and mode choice, and examined the interaction effects of these factors on mode selection. Our results reveal that, compared to socio-demographic factors, the BE substantially influence commuter travel behavior. The BE characteristics have a specific nonlinear threshold limit at which they can have a notable impact on lowering private car use, and private car use does not display a constant return of scale with BE. Their interaction effects illustrate the potential optimal combination of BE interventions to lower private car use for commuting. These findings hold substantial implications for urban environmental policy, emphasizing the need for transit-oriented development, travel demand management, and integrated land-use transportation planning to foster low-carbon transportation systems in cities like Dhaka.