I can't remember the details myself, or where I read it, but just did a quick refresher. Essentially the N-type side is doped with an impurity that provides an excess of free electrons, whilst the P-type doped to provide an excess of "holes" . An example dopant for N-type is Phosphorus which has 5 electrons in its outer shell, while P-Type might use Boron which has 3 electrons (silicon having 4 outer shell electrons).
At the PN junction, free electrons pass into the P side to fill the holes but in doing so leave a resultant charge at the junction which creates a small depletion area (visible as 0.6-0.7V forward bias voltage) . Driving it the junction in reverse bias expands the depletion region as you stated to resist current flow.
Whoever, thought this stuff up was seriously smart!