PN junctions are fundamental to many devices including diodes and transistors. PN junctions essentially are a material with one side positively changed and another side negatively charged. This is typically achieved in semiconductor PN junctions by doping the concentration with atoms that adjust the overall charge of the material. Acceptor atoms increase the number of electron holes in a material while donor atoms increase the number of electrons in the outer orbitals of the material.
The difference in charge produces a potential difference. We call this the built in potential. We can identify a built in potential of the P and N side.
Under a zero bias, the PN junction, a depletion region naturally occurs at the interface of the P and N regions through the joining of the donor electrons and electron holes from the doped regions.
Drift and diffusion current also occurs with the transport of charge carriers from the N region to the P region and from the P region to the N region.