There's no absolute rules as to when a composer should use one over the other - it often comes down to the tempo and feel of the music, but it is subjective. I've (for better or worse) seen Presto 3/4 pieces that go much faster than some 3/8 pieces.
The big difference in terms of timing is that 3/8 is mainly used as a compound time, whereas 3/4 is most commonly conducted in simple time. So if the composer "felt" that a bar should be conducted as a single unit rather than 3 individual beats, that might be a particular reason to choose one over the other. Tempo of course does come into it as well.
Of course, then we get to the question of why 3/8 should be used over 6/8, and so on - sometimes when the phrases work in odd numbers this is clearer, but more often than not it's just at the composer's discretion to emphasise various beats and timings slightly differently.