Although shared e-scooters have displayed both complementary and competitive relationships with public transport, less attention has been paid to investigating the spatiotemporal variations of such relationships, and how the relationships are associated with the urban built environment. To bridge the gaps, we first explore the spatiotemporal heterogeneity of such relationships by conducting a comparative study of Stockholm and Helsinki based on the empirical data. Then, an explainable AI method is applied to examine the associations between the relationships and built environment. We found that Helsinki presents higher ratios of the competitive dominant areas (DPET) compared with Stockholm showing higher ratios of the complementary dominant areas (DPLE). The correlation analysis results indicate that the distance-to-public-transport is associated with DPET in two cities. Some factors present a non-linear effect, e.g., the density-of-the-population, etc. This study is beneficial for the better integration of shared e-scooters and public transport towards sustainable urban mobility systems.