Sometimes we find that the result we want from a quantum algorithm is expressed in terms of a basis that is different from the usual computational basis, which I will call
$$ B_C = \left\{ \lvert 0 \rangle, \lvert 1 \rangle \right\} = \left\{ \left(\begin{array}{c}1\\0\end{array}\right),\left(\begin{array}{c}0\\1\end{array}\right) \right\}. $$
For example, at the end of the Deutsch's algorithm, the first qubits is in the state
$$ \lvert\psi\rangle = (-1)^{f(0)} \dfrac{\lvert 0 \rangle + (-1)^{f(0) \oplus f(1)} \lvert 1 \rangle}{\sqrt{2}}, $$
which can be expressed in terms of the Hadamard's basis
$$ B_H = \{ \lvert + \rangle, \lvert - \rangle \} = \left\{ \dfrac{1}{\sqrt{2}} \left( \begin{array}{c}1\\1\end{array} \right), \dfrac{1}{\sqrt{2}} \left( \begin{array}{c}1\\-1\end{array} \right) \right\} $$
$$ \begin{cases} f(0) \oplus f(1) = 0 \quad\Rightarrow\quad \lvert\psi\rangle = (-1)^{f(0)} \lvert + \rangle \\ f(0) \oplus f(1) = 1 \quad\Rightarrow\quad \lvert\psi\rangle = (-1)^{f(0)} \lvert - \rangle \end{cases} $$
Therefore, we can get the value of $f(0) \oplus f(1)$ just by measuring $\lvert\psi\rangle$ on $B_H$. Since we can only perform physical measurements on $B_C$, this can be achieved performing a change of basis.
Given two basis $A$ and $B$, if the matrix that transforms the elements of $A$ to the elements of $B$ is the matrix $M$, this is also the matrix that maps the coordinates of vectors with respect to $B$ to their coordinates with respect to $A$. Hence, which of these propositions is the correct to express the change of basis we must do to perform the measurement on $B_H$ knowing that physical measurements are actually performed in $B_C$?
We must apply the Hadamard's gate, because the matrix $H$ maps $\left\{ \lvert 0 \rangle,\lvert 1 \rangle \right\}$ to $\left\{ \lvert + \rangle, \lvert - \rangle \right\}$, and therefore it transforms the components $\lvert\psi\rangle_{B_H}$ to $\lvert\psi\rangle_{B_C}$.
We must apply the Hadamard's gate, because the matrix $H$ maps $\left\{ \lvert + \rangle,\lvert - \rangle \right\}$ to $\left\{ \lvert 0 \rangle, \lvert 1 \rangle \right\}$, and therefore it transforms the components $\lvert\psi\rangle_{B_C}$ to $\lvert\psi\rangle_{B_H}$.