The conjugate problem of aerodynamics and heat and mass transfer in heat-shielding structures made of ablating polymer composite materials is considered. To determine the heat fluxes in the shock layer, the chemical composition of the atmosphere is taken into account. A mathematical formulation of the joint problem is formulated and an algorithm for numerical solution is proposed. An example of a numerical solution of the problem for the reentry spacecraft Stardust is presented. It is shown that due to the high temperatures of aerodynamic heating of a structure made of a polymer composite material, an intense internal generation of gas appears in the structure of the material, which can lead to the destruction of the material.