This is probably better off asked on the physics stack, but essentially:
You have two differently doped semiconductors, one P-type and one N-type. The N-type has excess electrons, and the P-type has excess "holes" (which means the absence of an electron in an electron shell)
When you bring the P and N type materials together, you form a P-N junction. At the junction, some of the excess electrons cross over and fill the holes in the P-type material, forming a depletion zone (essentially a built in potential):
This depletion zone is (almost) non-conductive, as it has no free charge carriers. Now if we apply a potential (voltage) across the junction, depending on the polarity, the depletion zone either widens or narrows. If the region widens, the non-conductive region increases and no current can flow through the diode.
If it narrows, at a certain potential (~0.7V for a silicon diode) the diode will begin to conduct. This (hopefully) explains why the diode acts in the way it does.
Above images from this introduction to diodes.
Also, this image (from the Wikipedia P-N Junction link above) shows the P-N junction with a little more information than the above images: