there are many stomatas in the lower epidermis of the leaf.
after the C02 diffuses through the stomata, it passes through the spongy mesophyll, which has lots of air gaps between the cells, so the gas can easily diffuse to the next layer.
after the spongy mesophyll layer, it diffuses to the palisade mesophyll layer, which is packed with palisade cells that have so many chloroplasts.
then after the palisade mesophyll it reaches the upper epidermis, which is full of epidermal tissue (like the lower epidermis), the UE is very thin and transparent so the sunlight can get through the layer to get to the chloroplasts in the palisade cells (in palisade mesophyll)