Dolomite reservoirs formed by dissolution are significant for hydrocarbon exploration, but their origins are poorly understood because of their complexity. This study investigated the lower Permian Qixia Formation of the Sichuan Basin (northern Longmenshan Mountains), southwestern China, which has recently been the location of giant natural gas discoveries. Petrological and geochemical analyses were undertaken, including trace elements and C, O, and Sr isotopes. The results indicate that the reservoirs were formed by differential eogenetic karstification and hydrothermal dissolution of grain dolomites. Core and thin-section observations identified three types of dolomite based on grain size: fine- to medium-crystalline dolomite (Dol-1), medium- to coarse-crystalline dolomite (Dol-2), and coarse- to megacrystalline saddle dolomite (Dol-3). The Dol-2 types can be further divided into three subtypes according to the grain structure and degree of pore development: euhedral medium- to coarse-crystalline dolomite with pores (Dol-2a), porous subhedral–anhedral medium- to coarse-crystalline dolomite (Dol-2b), and tight subhedral–anhedral medium- to coarse-crystalline dolomite (Dol-2c). The Dol-1 types appear to have formed because of the release of and subsequent metasomatism by Mg2+ in trapped seawater along stylolites at shallow burial conditions (500–1000 m). The Dol-2a types resulted mainly from eogenetic karstification of original limestone and subsequent dolomitization by marine-related fluids. These dolomites are geochemically characterized by relatively flat rare-earth element patterns and relatively low Y/Ho values (mean = 37.1). The Dol-2b and Dol-3 types were formed mainly by hydrothermal fluids and have similar rare-earth element patterns with large positive Eu anomalies (mean = 5.7). The Dol-2c types experienced metasomatism by marine-related fluids mixed with minor hydrothermal fluids. All these formation mechanisms reflect the influence of multistage diagenetic and hydrothermal fluids. The Dol-2a types form the most favorable reservoirs in the study area, followed by the Dol-2b types. The distribution of the Dol-2a types was controlled by eogenetic karstification of grain shoals, whereas that of the Dol-2b types reflects the influence of tectonically derived hydrothermal fluid dissolution of grain shoals. As such, both primary sedimentary features and later differential dissolution (eogenetic and hydrothermal) contributed to reservoir development, which involved factors such as the sedimentary facies (grain shoal), sea-level fluctuations (eogenetic karst development), and faulting (hydrothermal dissolution). Therefore, the formation of dolomite and associated reservoirs is complex. The results of this study provide an improved understanding of the origins and complexity of dolomite reservoirs formed by dissolution, which is relevant to exploration for such reservoirs.