So we have a 2D rotation matrix for counterclockwise (positive) angle "$a$":
$\begin{pmatrix}
\cos(a) & -\sin(a) \\
\sin(a) & \cos(a)
\end{pmatrix}$.
For clockwise (negative) angle: $\begin{pmatrix} \cos(a) & \sin(a) \\ -\sin(a) & \cos(a) \end{pmatrix}$.
When converting euler angles to 3d rotation matrix we extend rotation matrices of yaw ($z$), pitch ($y$) and roll ($x$) angles and multiply them. The same convention is used for all angles: counterclockwise direction, right-handed system.
$R_x = \begin{pmatrix} 1 & 0 & 0 \\ 0 & \cos(x) & -\sin(x) \\ 0 & \sin(x) & \cos(x) \end{pmatrix}$, $R_y = \begin{pmatrix} \cos(y) & 0 & \sin(y) \\ 0 & 1 & 0 \\ -\sin(y) & 0 & \cos(y) \end{pmatrix}$, $R_z = \begin{pmatrix} \cos(z) & -\sin(z) & 0 \\ \sin(z) & \cos(z) & 0 \\ 0 & 0 & 1 \end{pmatrix}$.
Why is the direction of rotation for the pitch angle (sign of sin elements) different from yaw and roll angles? Thanks.
Matrix rows or columns are traditionally listed under $(x,y,z)$ order.
Cyclically change the pairs under consideration i.e $(x,y)\to(y,z)\to(z,x)$. The pairs $(x,y)$ and $(y,z)$ show up in the same order in the matrix but the $(z,x)$ shows up in reverse in the matrix. That is the cause of apparent discrepancy but really there is no discrepancy.
For example write
$x'=x\cos \alpha - y \sin \alpha$
$y'=x\sin \alpha + y \cos \alpha$
now change $(x,y)\to(y,z)\to(z,x)$ and $\alpha\to \beta \to \gamma$ and write the three matrices to see how $(z,x)$ part gets flipped.
Edit:
If you want them to look alike then give up the matrix notation and instead write
$y'=y\cos \beta - z \sin \beta$
$z'=y\sin \beta + z \cos \beta$
And
$z'=z\cos \gamma - x \sin \gamma$
$x'=z\sin \gamma + x \cos \gamma$
In each instance if you try to write $\left[ \matrix{ x' \cr y' \cr z'}\right]$ in terms of $\left[ \matrix{ x \cr y \cr z}\right]$ you will see that the mystery goes away.