OpenGL translation before and after a rotation

Now, my question is for the elbow. Why is there a translation forward on the x-axis both before and after the rotate?

If you want to imagine how the matrix operations change the model, then you need to "read" the operations in the reverse order. This is, because the current matrix of the matrix stack is multiplied by the matrix which is specified by the new operation and the matrices are stored in column-major order (fixed function pipeline).

Start with the elbow cube

glutWireCube(1.0f);

arm 01

Scale the elbow

glPushMatrix();
glScalef(2.0f, 0.4f, 1.0f);
glutWireCube(1.0f);
glPopMatrix();

arm 02

Move it to the right

glTranslatef(1.0f, 0.0f, 0.0f);

arm 03

Rotate the elbow

glRotatef(45.0f, 0.0f, 0.0f, 1.0f);

arm 04

Move the rotated elbow to the right

glTranslatef(1.0f, 0.0f, 0.0f);

arm 05

Draw the shoulder cube

glutWireCube(1.0f);

arm 06

Scale the shoulder

glPushMatrix();
glScalef(2.0f, 0.4f, 1.0f);
glutWireCube(1.0f);
glPopMatrix();

arm 07

Move the arm (elbow and shoulder) to the right

glTranslatef(1.0f, 0.0f, 0.0f);

arm 08

Rotate the arm

glRotatef(-15.0f, 0.0f, 0.0f, 1.0f);

arm 09

Move the arm to its final position (to the left)

glTranslatef(-1.0f, 0.0f, 0.0f);

arm 10