When describing the dynamics of a process in a container or a closed laboratory system, we have to include the description of the way the system communicates with the environment. In our paper we deal with the process of heat conduction. At the boundary of the container we may fix the temperature, or insulate the container, or balance the heat flux with the temperature. More recently, many authors consider the so-called dynamic boundary condition saying that the speed of change of the temperature of the boundary is proportional to the heat flux through the boundary. In our paper we derive this dynamic boundary condition from heat conduction with a pronounced boundary layer. That is, the boundary layer is thin but its specific heat is high, e.g. inversely proportional to the layer width. We perform the limit passage and on the way we develop tools from the calculus of variations based on the Gamma-convergence of functionals. We also discover a new version of the Reilly identity appearing in differential geometry.