The heat is transfered from the solid or liquid by the surrounding gas.
Real Fluids have a finite viscosity. They resist deformation and this has a significant effect on convective heat transfer.
A fluid having a free-stream velocity of u flows past a solid surface or wall, such as a flat plate, the fluid velocity is constrained by viscosity to be zero at the wall. The velocity therefore varies from zero at the wall to u far from the wall.
The boundary layer can be considered stagnant and the convection of heat can be seen as heat conduction in this region. This means that resistance to heat flow is proportional to the thickness of the boundary layer.
William R. Hamburgen, "Optimal Finned Heat Sinks" digital Western Research Laboratory