Homosexual refers to both sexes, however, Lesbian derives from the word Lesbos which is an island off Greece. Lesbos was home to Sappho a famous poet who loved women and wrote many poems for women one of which was The Ode to Aphrodite. Many of her love poems are now lost. (I am really bad at history and have a hatred of dates sorry). In the same was ‘gay’ became a popular word referring to male homosexuals in the early 19th century. So each word was spurred by the culture of the times. I think that lesbian became used as an insult towards a female (as many words do they change over time) so females took on the word gay as it sounded in both cases referring to both males and females a lot happier (!).
During the time the word gay was used homosexuality became a lot more accepted. However, people obviously have started to use the word gay as an insult too.