A diode is an active device that consist of a pn junction that was made on s semiconductor. The junction is usually realised by consecutive diffusion of acceptor and donor dopants one one side of a semiconductor or by ion implantation.
The figure for the band energy diagram of a diode is below.
When the pn junction is realised, because of the intimate contact between the two sides, at the contact zone, a part of electrons that are in excess in the n semiconductor fall into the p semiconductor and the holes from the p semiconductor occupy the n semiconductor. Thus two things happen. First The Fermi level (the energy level that has a probability of being filled with electrons of 0.5) will be the same on both sides (pinned on the donor level in the p side and pinned on the acceptor level on the n side). Second an internal electric field field will be created. For a Silicon pn junction the value of the potential of this field is 0.7 V. When a external voltage is applied with positive potential to the p side and negative potential to the n side, this internal field will be diminished until it completely vanishes, thus letting the current flow through the junction. When the external voltage is applied inversely, it will further increase the internal field of the junction, which in turn will oppose the flow of the current through the structure.
Thus a diode is a device that allows the current to flow only in one direction through it. This is why it is called an active device.