The sandstone sections in the Upper Jurassic red beds of the Yongjin area in the central Junggar Basin are important oil and gas reservoirs. The debate over whether red beds are of primary depositional or secondary diagenetic origin persists, leading to uncertainties in the interpretation of reservoir sedimentary facies. This study uses core samples and employs thin section microscope observations, scanning electron microscopy, X-ray diffraction, and major and trace element analyses to investigate the formation period and paleoclimate conditions of red beds and explore the origin of red sandstone. The Upper Jurassic red beds are mainly deposited in arid delta plain environments. The framework grains of the red sandstone are composed of quartz (averaging 22.6%), feldspar (averaging 16.3%), and rock fragments (averaging 36.7%). The rock fragments in the sandstone are mainly composed of intermediate basic volcanic rocks and cryptocrystalline acid volcanic rocks, which are rich in mafic silicate minerals such as olivine, pyroxene, ilmenite, and magnetite. In situ hematitization of ilmenite is observed in the rock fragments, suggesting that the in situ alteration of mafic silicate minerals in the parent rock is the main source of iron ions for hematite. Tiny hematite crystals (2.1 mu m) are observed in clay mineral micropores via SEM. Abundant mixed-layer illite/smectite clay indicates early smectite transformation, providing a minor source of iron ions for hematite. Hematite in the red sandstone occurs as a grain-coating type, predating quartz overgrowth, feldspar overgrowth, and (ferroan) calcite and (ferroan) dolomite precipitation. Residual hematite coatings between detrital grain point contacts indicate that hematite is a product of syn-sedimentary or very early diagenetic precipitation, ruling out the possibility that red sandstone formation was caused by later atmospheric water leaching during the fold and thrust belt stage. The average chemical index of alteration (CIA) for the red sandstone is 52.2, whereas the CIA for the red mudstone averages 59.5, and the chemical index of weathering (CIW) reached a maximum of 69. These values indicate that the rocks have undergone mild chemical weathering in arid climates. Additionally, the ratios of trace elements indicate that the water bodies were in an oxidizing state during the sedimentary period. The arid climate and oxidative water conditions were ideal for hematite preservation, thus facilitating red bed formation. The red bed sediments in the study area represent a direct response to the Late Jurassic aridification event and can be compared to global climate change. The results have important implications for stratigraphic correlation and interpretation of reservoir sedimentary facies in the study area while also providing a valuable case study for global research on red beds.