Time series analysis plays a pivotal role in our daily lives, exerting a profound impact on our everyday activities. Traditional time series prediction models focus on analyzing temporal and spatial correlations but often overlook the underlying causal relationships. Integrating causal reasoning into models allows for a deeper understanding of the data generation mechanisms. Our paper proposes an innovative causal spatiotemporal graph neural network against confounding bias (CSTCB), which approaches the problem of time series prediction from the perspective of causal relationships. By applying the front-door criterion, we can calculate the causal effect of input variables on the prediction outcome, effectively eliminating the bias introduced by hidden confounders. Furthermore, we propose counterfactual reasoning methods, analyzing the causal link between predictions and inputs by setting different input scenarios, thereby reducing the interference of environmental factors. Finally, we evaluate our method on four public transportation datasets, and the experimental results show that CSTCB not only has better interpretability but also outperforms 11 baseline methods, with a 2% improvement in MAE metrics for the PeMSD8 dataset.