General Concept
A diode is an electronic device that only lets current flow in a single direction. Most diodes use a Semiconductors as their building block. By placing a p-type doped material next to a n-type doped material we make what’s called a P-N junction.
Where these materials meet we get what is called a depletion region. Some of the electrons will fill the holes making negative ions, and leaving behind positive ions, creating an electric field which opposes any electrons from moving through the region. By applying a voltage, specifically where the negative side is attached to the n-type side and the positive is attached to the p-type side we add excess charges which lets the charges overcome the potential created and flow. If we hooked up the diode in the opposite direction, the holes would be pulled towards the negative terminal while the electrons would be pulled to the positive terminal moving away from the P-N junction and not letting current flow.