This study aims to investigate the depositional environment, sediment sources, and elemental occurrence of Upper Paleozoic coal in the Renjiazhuang Mining District, Western Ordos Basin. Furthermore, SEM-EDX, optical microscope (OM), ICP-AES, ICP-MS, and AAS were used. Compared with hard coal of the world, M3 coals were enriched in Ga, Li, Zr, Be, Ta, Hf, Nb, Pb, and Th, M5 coals were enriched in Li (CC = 10.21), Ta (CC = 6.96), Nb (CC = 6.95), Be, Sc, Ga, Hf, Th, Pb, Zr, In, and REY, while M9 coals were enriched in Li (CC = 14.79), Ta (CC = 5.41), Ga, W, Hf, Nb, Zr, Pb, and Th. In addition, minerals were mainly composed of kaolinite, dolomite, pyrite, feldspar, calcite, and quartz, locally visible minor amounts of monazite, zircon, clausthalite, chalcopyrite, iron dolomite, albite, fluorite, siderite, galena, barite, boehmite, and rutile. In addition, maceral compositions of M3 coals and M9 coals were dominated by vitrinite (up to 78.50%), while M5 coals were the main inertite (up to 76.26%), and minor amounts of liptinite. REY distribution patterns of all samples exhibited light REY enrichment and negative Eu anomalies. The geochemistry of samples (TiO2 and Al2O3, Nb/Y and Zr × 0.0001/TiO2 ratios, and REY enrichment types) indicates that the sediment sources of samples originated from felsic igneous rocks. Indicator parameters (TPI, GI, VI, GWI, V/I, Sr/Ba, Th/U, and CeN/CeN*) suggest that these coals were formed in different paleopeat swamp environments: M3 coal was formed in a lower delta plain and terrestrial (lacustrine) facies with weak oxidation and reduction, and M5 coal was formed in a terrestrial and dry forest swamp environment with weak oxidation–oxidation, while M9 coal was formed in a seawater environment of humid forest swamps and the transition from the lower delta plain to continental sedimentation with weak oxidation and reduction. Statistical methods were used to study the elemental occurrence. Moreover, Li, Ta, Hf, Nb, Zr, Pb, and Th elements were associated with aluminosilicates, and Ga occurred as silicate.