tikZ and LaTeX
PGF/TikZ is a tandem of languages for producing vector graphics from a geometric/algebraic description. You can use this language inside tex files, to programmatically draw nice 2D and 3D graphics. Another package which some people prefer for 3D is asymptote.
Read the manual.
Tutorials for tikZ
For more information read one of the tutorials and the tikz resources page, which includes helpful tools etc.
There are tutorial videos online like this video. There are also tutorials on youtube like the following, but this does not cover 3D graphics unfortunately:
To learn how to make 3D stuff, start by looking at the examples below. If you can make sense of it...
tikZ 3D examples
Look at the 3D tikz example page for more 3D examples.