I will include an answer using Einstein notation, because I work with high order tensors and this notation makes this kind of derivative very easy to obtain.
$$f(\mathbf{x}) = \left[A_{ij}\,x_j-b_{i}\right] \left[A_{ik}\,x_k-b_i\right] = A_{ij}\,A_{ik}\,x_j\,x_k - b_i\,A_{ij}\,x_j - b_i\,A_{ik}\,x_k + b_i\,b_i$$
$$f(\mathbf{x}) = A_{ij}\,A_{ik}\,x_j\,x_k - 2\,b_i\,A_{ij}\,x_j + b_i\,b_i$$
We have that $\frac{\partial x_i}{\partial x_j} = \delta_{ij}$, thus:
$$\frac{\partial f}{\partial x_p} = A_{ij}\,A_{ik}\,\delta_{jp}\,x_k + A_{ij}\,A_{ik}\,x_j\,\delta_{kp} - 2\,b_i\,A_{ij}\,\delta_{jp} = A_{ip}\,A_{ik}\,x_k + A_{ij}\,A_{ip}\,x_j - 2\,b_i\,A_{ip}$$
We can then transpose some terms to get:
$$\frac{\partial f}{\partial x_p} = A^T_{pi}\,A_{ik}\,x_k + A^T_{pi}\,A_{ij}\,x_j - 2\,A^T_{pi}\,b_i = 2\left[A^T_{pi}\,A_{ij}\,x_j - A^T_{pi}\,b_i\right]$$
In matrix notation we get:
$$\boxed{\frac{\partial f}{\partial \mathbf{x}} = 2\,\mathbf{A}^T\left[\mathbf{A}\,\mathbf{x}-\mathbf{b}\right]}$$
If $\mathbf{A}$ is invertible, we get:
$$\frac{\partial f}{\partial \mathbf{x}} = \mathbf{0} \Leftrightarrow \mathbf{x} = \mathbf{A}^{-1}\,\mathbf{b}$$
If $\mathbf{A}$ is rectangular and $\mathbf{H} = \mathbf{A}^T\mathbf{A}$ is invertible, considering $\mathbf{q} = \mathbf{A}^T\,\mathbf{b}$, we get:
$$\frac{\partial f}{\partial \mathbf{x}} = \mathbf{0} \Leftrightarrow \mathbf{x} = \mathbf{H}^{-1}\,\mathbf{q}$$
For singular matrices, there should be infinite solutions for the minimization problem.