Shale contains a large number of nanopores. The nanopores control the reservoir structure. The formation of nanopores in shale is closely related to the sedimentary environment. The palaeosedimentary structural background determines the provenance and sedimentary diagenesis of mud shale during shale deposition, refines the palaeo-shale and palaeo-sedimentary-tectonic environments of the Longmaxi Formation in the southern Sichuan Basin by elemental geochemical means, and determines the palaeo-deposition of the Longmaxi Formation. The tectonic setting and a numerical simulation method are used to explore the sedimentary tectonic evolution characteristics of the Longmaxi Formation. The results show that the parent rock of the Longmaxi Formation is relatively enriched with light rare earth elements, and the distribution of heavy rare earth elements is relatively stable. The vertical direction shows a trend of increasing from the bottom of the formation to the top of the formation, showing a mixed genesis; the tectonic setting is a passive continental margin, and the active continental margin is the main margin.