There are many factors that influence both the generation and dissipation of heat.
While the engineering details between the two models of iPhone will differ - and are not published by Apple - consider that the number of available and active CPU/GPU cores are not the same. Clock-speeds may also differ, higher rates invariably creating more heat than lower clock speeds.
Internal physical architecture will also be different, influencing the ability to dissipate heat; the iPhone Air has a larger surface area to distribute heat that is generated, this ultimately determining the rate that heat can be lost to the environment. The iPhone 17 Pro's new vapour chamber technology simply improves the rate that heat can be conducted away from the CPU/GPU to the iPhone Pro's casing, from which the heat can be "lost" to the environment.