From this dicussion,
$$ \hat \beta = \frac{\widehat{\mathrm{cov}}(y_i, x_i)}{\widehat{\mathrm{var}}(x_i)}. \tag{3} $$
$$ \hat \gamma = \frac{\frac{1}{n} \sum_i y_i x_i}{\frac{1}{n} \sum_i (x_i)^2} \tag{4} $$
Comparing $(3)$ and $(4)$, we see that they are the same if the mean of $x$ is zero: $\frac{1}{n} \sum_i x_i = 0$.
How to prove that (3) similar to (4) based on the condition above?
Updated, what I have tried is:
(3) can be explained to
$$ \hat \beta = \frac{\sum_i(x_i-\bar x)(y_i-\bar y)}{\sum_i(x_i-\bar x)^2}. \tag{5} $$
or based on the condition
$$ \hat \beta = \frac{\sum_ix_i(y_i-\bar y)}{\sum_i(x_i)^2}. \tag{6} $$
while (4) is still the same $$ \hat \gamma = \frac{\sum_i y_i x_i}{\sum_i (x_i)^2} \tag{7} $$
So the question that remained here is how to prove
$$\sum_ix_i\bar y=0$$
In (6) the term $\sum_i x_i\bar y$ equals zero, because $\bar y$ can be factored out, producing $\bar y\sum_i x_i$.