Say that class A uses class B, and B uses C.
If no class files exist, then compiling A would create all 3.
Now, let's say you drastically change C, so that both A and B really need to be compiled. Then compile A. The compiler looks at B, sees that its B.class file is up to date with respect to its B.java file, and
does nothing. C gets compiled, as does A, but B isn't touched. You may now get a runtime error.
A good build tool can (among other things) keep track of this kind of dependency; you can tell it that B depends on C, so that modifying C will force B to be recompiled.
Of course, build tools do a lot of other things too: automate version control, packaging, installation,
testing, and other parts of development.