Forming environments have important effects on the dispersion and enrichment of trace elements in coal. The C3 coal seam of the Xuanwei Formation in eastern Yunnan was used as a case study to reconstruct the peat-forming environment based on coal facies parameters and geochemical characteristics, and its influence on trace element (including rare earth elements and yttrium, REY) enrichment was investigated. The C3 coal was classified as medium rank bituminous coal with an ultra-low moisture content, medium-high ash yield, and medium-low volatile content. Compared to the average values for Chinese coal, Cu and V were enriched and Co was slightly enriched in the C3 coal. Compared with the average values for world coal, Cu and V were enriched while several other trace elements were slightly enriched in the C3 coal, including Co, Hf, Nb, Sc, Ta, Zn, and Zr. The C3 coal was deposited in the limno-telmatic environment with fresh water, and reducing conditions. Trace elements, including Cu, V, Hf, Nb, Sc, Ta, Zr, Zn, Co, and REY, were typically enriched in the limno-telmatic environment with fresh water and reducing conditions. Additionally, REY and V were also significantly enriched in brackish water limno-telmatic conditions with the same depositional environment.