The sedimentary environment and organic matter (OM) accumulation are vital indicators for shale gas exploration. However, research on deep shale gas systems is relatively limited; moreover, the exploration of deep shale gas in the southeastern Sichuan Basin has entered a period of stagnation. In this study, systematic geochemical analysis of Wufeng (WF) and the first member of the Longmaxi (Long-1) deep shale samples from the recently drilled DY7 well in the Dingshan area of the Sichuan Basin is carried out, and the longitudinal variations in major and trace elements are revealed. The differences in the WF, lower section of the Long-1 (Long-11) and upper section of the Long-1 (Long-12) shales are studied in terms of redox conditions, paleoproductivity, terrigenous detrital input, sedimentation rate and paleoclimate, and the different main controlling factors of OM accumulation for these three layers are discussed. The WF shale has a higher TOC content (mean: 5.73%), the Long-11 shale has a high TOC content (mean: 2.89%), while the Long-12 shale has a low TOC content (mean: 1.44%). For the WF shale, due to complex geological events and large fluctuations in element contents, its TOC content is poorly correlated with these indices, redox and paleoproductivity proxies have a positive association with the Long-11 shale’s TOC content, but negatively correlated with terrigenous input and sedimentation rate indices. The formation of these two sets of organic-rich shales (TOC > 2%) is jointly controlled by good preservation conditions. In contrast, the TOC content of the WF shale is higher than that of the Long-11 shale as the result that terrigenous input and sedimentation rate of the Long-11 shale represent the dilution and destruction of OM, which is different from the former. During the Long-12 depositional period, the water column experienced weak reducing conditions and low productivity, and its high terrigenous debris input further diluted the OM, leading to a low TOC content.