Pure silicon semiconductor material is not very good at conducting electricity --- hence the name. When this material is baked in an oven, with a carefully selected gas, a small number of atoms are introduced into the material which changes its electrical behavior. This process is called "doping," and if it is done with one gas the results is an N-type semiconductor --- a semiconductor with extra electrons suspended in the material. With a different gas, a P-type semiconductor is produced --- with an absence of electrons --- called "holes."
When these two materials are used together, a variety of electrical effects can be produced. Just putting the two materials together produces a diode. When electrical potential is applied in one direction, the electrons and holes are pushed together and current flows. When electrical potential is applied in the other direction, the holes and electrons are pulled apart and no current flows.