Urban incidents, such as traffic accidents and crimes, pose significant challenges for city management. This thesis explores advanced machine learning and artificial intelligence (AI) solutions to enhance the forecasting and understanding of urban incidents using big spatiotemporal urban data. Early detection and understanding of these incidents can offer practical tools for city management to enhance urban safety and efficiency. However, it is computationally difficult to capture rare urban incidents over regions with different incident patterns. Additionally, it is challenging to understand the reasons leading to incidents. Existing machine learning solutions fail to capture complicated incident patterns over time and space and are struggling with explaining their predictions. This thesis presents our novel machine learning solutions to answering when, where, and why these incidents may happen. First, we propose HintNet and LISA framework to capture diverse incident patterns over space. Second, we propose SpatialRank to identify the riskiest incidents in a study area. Lastly, we propose GeoPro-Net to explain why there may be an incident. Comprehensive experiments on multiple large-scale crime and traffic accident datasets show that our solutions can accurately forecast urban incidents and explain why they happen.