It's a bit of a head scratcher but I believe it goes like this:
Biologically male or female, attracted to the opposite sex, happy to be identified as one's natal sex - straight
Biologically male, attracted to other biological males, happy to be identified as male: gay man
As above but female: Lesbian
Biologically male, attracted to other biological males, identifies as female: straight
As above, but female: straight
Biologically male, attracted to females, identifies as female: Lesbian
Biologically female, attracted to males, identifies as male: gay man
Biologically male or female, attracted to both biological females and males, whether happy to be identified as one's natal sex or not: bisexual, or nowadays may prefer to be labelled pansexual
You can see why some people say unhappy kids who are starting to realise that they are same-sex attracted and then identify as the opposite sex are transing the gay away, because at a stroke they turn from being a gay boy or a young lesbian to being straight.