In a p-n junction diode, the n side has donor atoms that provide free electrons, leaving behind a positive charge, while the p side has acceptor atoms that create holes, resulting in a negative charge. When the junction is formed, electrons from the n side and holes from the p side recombine, leading to a depletion region with reduced charge carrier density. This region exposes stationary positive charges on the n side and negative charges on the p side. The imbalance of these charges generates an electric field across the junction. This electric field is crucial for the diode's operation, influencing the movement of charge carriers.