The function of ecosystems as carbon sinks has emerged as a key strategy for advancing the concept of “carbon neutrality” and “carbon peaking”. Ecosystem carbon stocks are impacted by land use changes that alter ecosystem structure and function. We evaluated the ecosystem carbon stocks of Yunnan Province in different periods with the aid of the carbon stock module of the InVEST model, analyzed the relationship between land use type shift and ecosystem carbon stock changes, and combine them with the CA-Markov model to predict land use types in 2030. The results showed that between 1990 and 2020, changes in land use primarily affected cropland, grassland, and forested areas. The ecosystem’s average carbon stock from 1990 to 2020 was 8278.97 × 106 t. The carbon stocks of cropland, grassland, and unused land decreased by 31.36 × 106 t, 32.18 × 106 t, and 4.18 × 106 t during 1990–2020, respectively, while the carbon stocks of forest land, water area, and construction land increased by 24.31 × 106 t, 7.34 × 106 t, and 22.08 × 106 t. The main cause of the increase in carbon stocks in the ecosystem in Yunnan Province throughout the process of land use type shift was the development of forest land area, whereas the main cause of the decline was the shrinkage of cropland and grassland areas.