The basic unit is the "Bel", which is rather large for practical use.
So, divide the Bel by 10 and get the deci (10th) Bel.
So there are 10 deciBels in a Bel, and that is where the 10 comes from.
The Bel is a logarithmic ratio of two powers.
If we measure the powers directly, we can just put the numbers into the 10xLog(P/p) equation.
It is often more convenient to measure voltage rather than power.
Power is related to the square of the voltage (W = V^2 /R).
When working with logarithms to find the square of a number, just multiply the log of the number by two.
So we are squaring the voltage so the decibel equation becomes 2 x 10 x Log(V/v) = 20 Log(V/v).
Easy when you know!
A caveat.
When measuring voltage and calculating dB, the impedance at the input and output of the circuit should be the same, otherwise the power relationship is not correct.
Sometimes a gain of an amplifier will be expressed in dB when the input and output impedances are not the same.
This is not a correct thing to do, but it is done.
JimB