Coal self-heating in longwall goaf areas results from strongly coupled gas flow, heat transfer, mass transport, and chemical reactions occurring within a porous medium containing residual coal. This study presents a mathematical and numerical model for analysing these transient and non-isothermal processes with spatially variable permeability based on in-situ mining data. The model accounts for gas filtration through the porous goaf, heat and mass transfer between the gas and solid phases, heterogeneous coal oxidation, homogeneous gas-phase reactions, continuous methane emission, and the possibility of nitrogen inertisation. The governing equations form a strongly coupled non-linear system and are solved using the finite volume method. Numerical simulations were performed for U-type and Y-type ventilation layouts. The results provide spatial distributions of methane, oxygen, and carbon monoxide concentrations, gas temperature, solid-phase temperature, pressure, and gas velocity. The simulations demonstrate that ventilation configuration affects oxygen penetration, gas composition, and temperature development within the goaf. In particular, the Y-type ventilation system promotes deeper oxygen ingress into the porous zone, which may increase the extent of regions susceptible to coal self-heating. The proposed approach provides a framework for analysing coupled thermal and transport phenomena associated with spontaneous coal combustion and for assessing the influence of ventilation conditions on the development of thermal hazards in longwall goaf areas.