Why is C-5 Galaxy not used for commercial airlines while Boeng 747 is?
C-5 Galaxy was designed to military requirements that for cargo aircraft include:


operating from unpaved runways (I am not sure in case of C-5, but probably yes)
operating from airfields without much support
operating from short runways
paradrop capability


These basically imply a high-wing design so that engines are high (to minimize risk of foreign object damage) and the deck is lower for easier loading, front and rear cargo door with loading ramps so loading is possible without any ground infrastructure and some excess thrust for sufficient performance on short fields.

However that design is less efficient. It has higher operating cost. The air force is willing to pay it, because it needs the capabilities it requested. But commercial operations don't need those things, because it has enough well equipped airports to operate from. So the higher cost of operating an L-500 (as civil version of C-5 would be called) makes it uninteresting.

B-747 only shares one design feature with C-5, the raised cockpit that allows full-height (well, almost) cargo door in the nose, but otherwise it is optimized to minimize operating cost, making it great cargo plane for operations between airports.



On a side note, there is some commercial demand for transporting heavy or large cargo to less equipped airports. These are currently covered by ex-soviet-military An-124 aircraft that look very similar to Galaxy, are a bit larger, are certainly able to land on unpaved runways and were simply available when Soviet Union collapsed.