How to convert the 3D rectangular coordinate axes in the figure to this standard form?

U = Tuples[{-2, -1, 1, 2}, 3];

pointsByZ = GroupBy[U, Last];

colors = {-2 -> Red, -1 -> Blue, 1 -> Green, 2 -> Orange};

Graphics3D[
 Table[{z /. colors, PointSize[0.03], 
   Point[pointsByZ[z]]}, {z, {-2, -1, 1, 2}}], Axes -> True, 
 AxesLabel -> {"X", "Y", "Z"}, Boxed -> False, 
 Ticks -> {{-2, -1, 0, 1, 2}, {-2, -1, 0, 1, 2}, {-2, -1, 0, 1, 2}}, 
 BoxRatios -> {1, 1, 1}, PlotRange -> {{-3, 3}, {-3, 3}, {-3, 3}}, 
 PlotLabel -> Style["64 points colored by Z layer", Bold, 14], 
 ImageSize -> {600, 600}, 
 Epilog -> 
  Inset[Grid[{{Graphics[{Red, Disk[]}, ImageSize -> 10], 
      "z = -2"}, {Graphics[{Blue, Disk[]}, ImageSize -> 10], 
      "z = -1"}, {Graphics[{Green, Disk[]}, ImageSize -> 10], 
      "z = 1"}, {Graphics[{Orange, Disk[]}, ImageSize -> 10], 
      "z = 2"}}], {Right, Top}, {Right, Top}]]

The corresponding graph produced by the foregoing code is presented as follows:

The axes of the default spatial rectangular coordinate system generated by the preceding code are arranged on one side of the graph. Please advise how to revise the code to render the axes in the conventional form illustrated below.

You can try the option AxesOrigin -> {0, 0, 0}. To add arrowheads to the axes, the option AxesStyle -> Arrowheads[0.05] works in 2D but not in 3D.

You can simplify your plot quite a bit by using built in functions and options:

With[
 {segregatedData = GroupBy[U, Last]},
 ListPointPlot3D[segregatedData, PlotLegends -> Keys[segregatedData], 
  AxesLabel -> {"X", "Y", "Z"}, AxesOrigin -> {0, 0, 0}, 
  Boxed -> False, 
  PlotLabel -> Style["64 points colored by Z layer", Bold, 14]]]

ListPlotExample.bmp (489 KB)

You might want to add face grids or you might want to make the axes clearer with additional styling.

Apart from Gianlucas suggestion using AxesOrigin, you are working with `Graphics3D´ and here you can virtually do just anything, e.g. simply adding arrows along axis:

Graphics3D[{Table[{z /. colors, PointSize[0.03], 
    Point[pointsByZ[z]]}, {z, {-2, -1, 1, 2}}], Thick, 
  Arrow[{{-3, 0, 0}, {3, 0, 0}}], Arrow[{{0, -3, 0}, {0, 3, 0}}], 
  Arrow[{{0, 0, -3}, {0, 0, 3}}]}, Axes -> True, 
 AxesLabel -> {"X", "Y", "Z"}, Boxed -> False, TicksStyle -> Large, 
 Ticks -> {{-2, -1, 0, 1, 2}, {-2, -1, 0, 1, 2}, {-2, -1, 0, 1, 2}}, 
 BoxRatios -> {1, 1, 1}, PlotRange -> {{-3, 3}, {-3, 3}, {-3, 3}}, 
 PlotLabel -> Style["64 points colored by Z layer", Bold, 14], 
 ImageSize -> {600, 600}, 
 Epilog -> {Inset[
    Grid[{{Graphics[{Red, Disk[]}, ImageSize -> 10], 
       "z = -2"}, {Graphics[{Blue, Disk[]}, ImageSize -> 10], 
       "z = -1"}, {Graphics[{Green, Disk[]}, ImageSize -> 10], 
       "z = 1"}, {Graphics[{Orange, Disk[]}, ImageSize -> 10], 
       "z = 2"}}], {Right, Top}, {Right, Top}]},
 AxesOrigin -> {0, 0, 0}]