The sub base below the concrete is as important as the concrete itself. If you pour concrete over sand, dirt or clay, that sub base will move around as the ground water moves, especially in climates with freezing weather. As the sub base moves, it creates voids and pressure points that either inadequately support or put pressure on the concrete slab itself. A solid sub base of crushed stone is very stable, self draining and is not affected by ground water or freezing temperatures. It is also important, as I said, to either keep the concrete wet, or soak the concrete and apply a waterproof coating over the concrete so it cures properly. Concrete hardens by absorbing water into the cement portion of the concrete mix. It is not considered fully cured for 28 days, although with enough entrained water it will continue to harden slightly after the 28 days.
If you have ever watched a concrete roadway being built, they always put down a layer of crushed stone at least as deep as the anticipated concrete pour, for the reasons stated above. Now concrete roadways do crack, but mostly due to harmonic vibrations from heavy truck traffic and water getting into the expansion joints and heaving the concrete when the water freezes. Usually neither of these are a problem for a residential garage or driveway.
When I was a plant engineer at GM, our minimum spec was an 8" reinforced slab over 8" of crushed stone for general use. In locations where we would be installing heavy equipment producing a lot of vibration, we would go with a thicker slab. I do recall one piece of equipment, a vehicle shaker, in which you would suspend a complete vehicle suspended by plates attached to the wheel hubs in place of tires. These plates were attached to high speed hydraulic actuators. The hydraulic systems were controlled by computer systems using data from real world data from driving over a variety of actual road surfaces ranging from smooth paved roads to severely rutted gravel roads. The computer system drove the hydraulic system to simulate driving the vehicle over the programmed road surfaces. A single vehicle would be loaded into the shaker and "driven" constantly, 24/7 for MONTHS at a time, to see where suspension and body failure would occur. The slab beneath the shaker was 8 FEET thick!