From the example on the picture above, the surface of the front face of the cube lies on a positive $x$, therefore, $a_x$ is positive.
But why is $a_x$ negative in the case of the back face?
To make it more general, assume we are integrating with a two-dimensional space $(x,y)$, can we assume that the integral is in the negative $z$ dimension?
You should select the surface element ${\rm d}{\bf S} = {\rm d}S\hat{\bf S}$, in such a way that the unitary vector $\hat{\bf S}$ points outwards. So in this case, the front face points along the vector $\hat{\bf x}$, whereas the back face points along the vector $\color{red}{-}\hat{\bf x}$