just so you know, I didn't write this myself:
Inside an LED is a block of material made from two slightly different semiconductors. When in use electricity flow from one wire onto one side of the block, across the gap onto the other, and out onto the other wire.
Now, in elements, the outer valence electrons (which are what's involved in carrying urrent flows) exist at different distances from the nucleus, depending on the material.
Because the two different sides of the semiconductor block are made from different materials, there is an energy difference in the electron orbital levels from one side to the other. Electrons flowing from one side to the other act like a marble roling across the floor and meeting a step - they "fall" from the higher energy level material to the lower energy level material, and give off a "thump" in the form of a photon of light as they do.
The energy level of the photon of light emitted is equal to the diference in orbital energy levels between the two materials. Materials with very similar electron orbitals will give off low-energy photos, of red or infrared light. Greater differences in electron orbitals between the two materials gives higher-energy photons, of green or blue light.
So, it's simply a matter of the materials which the diode junction is made from. Low energy junctions were easiest to make, which is why red and infrared lights came first. Finding the right materials to make a blue LED took a lot longer, and they're still a lot more expensive than the common red types. There are about a dozen different semiconductor juction types in production now, each with its own emission wavelength.