Originally Posted by
sheets
It's from the position of the notes in a scale. The space between any two notes is called an interval, and all the intervals have names.
If we start with the G on a mandolin, a G major scale is G A B C D E F# G, so the spacing between the G and D string on a mandolin is called a 5th. If you start with a D scale, the 5th is an A. If you start with an A the 5th is an E. The strings are always a fifth apart. If you start with any note, and then move up to the 5th note above it in a major scale, that's an interval of a 5th.
Guitars are usually tuned in fourths (E to A, A to D, D to G, then B to E) plus one major 3rd interval B-E, which makes some chord forms easier.
Mandolins mirror the tuning of violins, violas and cellos, which all have strings tuned in fifths. The string bass came from a different family of instruments, it's tuned in 4ths, much like a guitar.