During thermal expansion the object is
heated on the inside. The cool air from the object is released into the air. Then the warm air must stay in the object stay. Then the heat air expans and changes the objects form. That is what happens to an object during thermal expansion.