Why negate z when constructing projection matrix OpenGL I constructed an orthographic projection matrix from  this article on scratchpixel.com:
Matrix4 ortho(float l, float r, float b, float t, float n, float f) {
   return Matrix4(
       2/(r-l), 0, 0, -(r+l)/(r-l), //row 0
       0, 2/(t-b), 0, -(t+b)/(t-b), //row 1
       0, 0, -2/(f-n), -(f+n)/(f-n), //row 2
       0, 0, 0, 1 //row 3
   );
}

, where r, l, t, b, n, f are right, left, top, bottom, near and far corners of the view box.
Now I tested out this matrix using the default parameters of the view box ortho(-1, 1, -1, 1, -1, 1) to see if I get an identity matrix. However I'm getting:
 1, 0, 0, 0,
 0, 1, 0, 0,
 0, 0, -1, 0,
 0, 0, 0, 1

Basically this will result in z coordinate of every transformed point to be negated.
Is it standard to negate the z coordinate when constructing projection matrix? What could be the purpose behind that?
I'm assuming your scene is constructed based on right-handed coordinates.
If you are using OpenGL, yes. If you are using Direct3D, no.
The projection matrix maps [-n, -f] into [0, 1]. This weird property comes from the fact that the eye coordinates are right-handed, but the clip space (NDC) uses left-handed coordinates. Hence the implementation of ortho().
Direct3D uses a z-axis that goes outwards the screen. Implementations for Direct3D projection matrices will not produce negated z when coupled with your application.