From Theoi.com, a Dionysus legend I'd never come across before:
"Someone asked Aesop why lesbians and effeminates [or gay men] had been created, and old Aesop explained, 'The answer lies once again with Prometheus, the original creator of our common clay.
All day long, Prometheus had been separately shaping those natural members which modesty conceals beneath our clothes, and when he was about to apply these private parts to the appropriate bodies
Liber [Dionysos] unexpectedly invited him to dinner. Prometheus came home late, unsteady on his feet and with a good deal of heavenly nectar flowing through his veins.
With his wits half asleep in a drunken haze he stuck the female genitalia on male bodies and male members on the ladies."
- Aesop, Fables 517 (from Phaedrus 4.16)