Building thermal insulation and energy conservation have become urgent problems in the field of civil engineering because they are important for achieving the goal of carbon neutralization. Thermal conductivity is an important index for evaluating the thermal insulation of materials. To study the influence of different porosity levels on the thermal conductivity of materials, this paper established a random distribution model using MATLAB and conducted a comparative analysis using COMSOL finite element software and classical theoretical numerical calculation formulas. The thermal conductivity of composite materials was determined based on a theoretical calculation formula and COMSOL software simulations, and the theoretical calculation results and simulation results were compared with the measured thermal conductivity of the composites. Furthermore, the influence of the width of the gaps between the materials on the heat transfer process was simulated in the fabricated roof structure. The results showed the following: (1) The thermal conductivity values calculated using the Zimmerman model were quite different from those calculated using the Campbell-Allen model and those calculated using the COMSOL software; (2) The thermal conductivity values calculated using the theoretical calculation formula were lower than the measured data, and the maximum relative error was more than 29%. The COMSOL simulation results were in good agreement with the measured data, and the relative error was less than 5%; (3) When the gap width was less than 60 mm, it increased linearly with the heat transfer coefficient. The heat transfer coefficient increased slowly when the gap width was greater than 60 mm. This was mainly due to the thermal bridge effect inside the insulation system. Based on these research results, a thermal insulation system was prepared in a factory.