When a p - n junction is formed, some of the free electrons in the n region diffuses across the junction and combine with holes to form negative ions. In doing so they leave behind positive ions at the donor impurity sites. Similarly, holes from p side diffuse to the n side and thus form a layer called diffusion layer at the junction. So the depletion region is caused by the diffusion of charge carriers.