Carbonate gas reservoirs generally contain water, leading to uneven water invasion, explosive water flooding and other prominent phenomena, which is an important factor restricting the efficient development of gas reservoirs. The study of gas-water two-phase flow behavior in carbonate gas reservoirs is of great significance for understanding the formation mechanism of residual water and trapped gas and improving the recovery of gas reservoirs. In this study, microscopic visualization physical models of fractured-vuggy and fractured-porous types were established based on CT images. And then gas-water two-phase flow experiments were conducted using the models, visually presenting the characteristics of gas-water two-phase flow and the formation mechanism of residual water and trapped gas in such reservoirs. On the basis of experiments, numerical simulation of gas-water two-phase flow at pore scale under high-temperature and high-pressure conditions was conducted using the VOF method, and the effect of capillary number on gas-water two-phase flow was quantitatively evaluated. The experiment results indicate the types of residual water and trapped gas formed in the fractured-vuggy and fracturedporous reservoirs. Compared with fractured-vuggy reservoir, the type of residual water in fracturedporous reservoir doesn't include water masses in the vugs, but includes network shaped residual water, and the type of trapped gas also includes network shaped trapped gas. The numerical simulation results indicate the residual water in the fractured-porous reservoir decreases with the increase of capillary number during gas flooding process, while the distribution of residual water in the fracturedvuggy reservoir is influenced by the combination of fractures and vugs. The distribution of trapped gas in different types of reservoirs shows a trend of first decreasing and then increasing with the increase of capillary number during water flooding process. The results in this study can provide theoretical support for revealing the formation mechanism of residual water and trapped gas in carbonate gas reservoirs and improve gas recovery.