Ramsey RESET Test The Ramsey RESET test uses the fitted value of y to test nonlinearity, for example:
$$
y_i=x_i\beta+\epsilon
$$
$$
\hat{y_i}=x_ib
$$
$$
y_i=x_i\beta+\gamma\hat{y}^2_i+u_i
$$
Test if $\gamma=0$
Why do we use $\hat{y}^2$ but not $x^2$?

You could indeed.
The usefulness of the Ramsey test however comes into play when you have several regressors, in which case you'd include the squares of all regressors $x_j$, $j=1,\ldots,K$ as well as their cross-products.
Also, you can include even higher powers of fitted values than squares in the Ramsey test, which would require even more terms if you aimed to capture nonlinearities via the regressors directly.
