The Diode Logic uses the fact that the diodes conduct only in one direction. (they behave like switches)
It is recommended first to read: Logic Levels
Diode Logic OR gate
(the wired OR connection)
Looking at the picture:

If one or both inputs are at logic "1" (5 volts), the current will flow through one or both diodes.
This current passes through the resistor and causes the appearance of a voltage across its terminals, thereby obtaining logic "1" on the output.
We only get logic "0" (0 volts) on the output when both inputs are in logic "0".
In this case, the diodes do not conduct, there is no current through the resistor R and there is no voltage across its terminals.
As a result the voltage at Vout is the same as ground (0 volts)
Diode Logic AND gate (the wired AND connection)

Looking at the picture:
When both inputs are at logic “1", the two diodes are reverse biased and there is no current flowing to ground.
Therefore the output is logic "1" because there is no voltage drop across the resistor R.
If one of the inputs is logic “0”, the current will flow through the corresponding diode and through the resistor.
Thus the diode anode (the output) will be logic "0".
This method works fine when the circuits are simple, but there are problems when you have to make interconnections with such gates.