Sand is good because it compacts and grows anaerobic bacteria. My 5 gallon tank has 2" of sand and denitrifies the water down to about 5ppm of nitrate at all times. It's stocked with two dwarf puffers and a banjo catfish and gets a 50% percent water change once a week. Without that sand and anaerobic bacteria the nitrates would be at least 40 ppm. The trick is that you can't disturb the sand or your bacteria die. But the bubbles that rise from it don't hurt anything, that's just a myth.
Also, sand lets most of the waste sit on top and it's easy to siphon away.
Gravel is kind of nasty because the rotting food it holds isn't worth the extra bacteria that might be on it. I use thin gravel in my 55g, less than an inch deep, and my jurupari keeps it clean for me. But because there is no denitrification, my nitrates stay in the 20 to 40ppm range most of the time and it's depressing. Next time I have money I'm changing it to sand.