You can create a square, and then, using the Pen tool (P) to create a bunch of anchor points to make different triangles like so:
Even before you've added in color it gives the perception of 3D.
You can then go to the Pathfinder Panel (Ctrl/Cmnd+Shift+F9) and use the Divide option.
Ungroup and color with different gradients - at different angles to better make it appear 3D.
In this exact example, this is how I recreated it:
Crated triangle and rounded the corners
Added in some lines using the pen tool and broke up the shapes using pathfinder (or shapebuilder)
Applied gradients