"White girl" has been slang for coke since forever. The white part is pretty self-explanatory but I'm not sure why girl, possibly because drug slang tends to refer to drugs as girls in general? Like MDMA is Mandy/Molly, LSD is Lucy, weed is Mary Jane, etc.
No idea why heroin is "boy" though. Possibly because it's brown so it's just the opposite of "white girl"? Just a pure guess though.