Seriously, we know now that BMO was made by Mo in his factory, but he definitely heard Candy talking at some point and decided to use her voice for his invention, because it's downright eerie how much they sound alike.
Maybe Candy's soul was transferred into BMO before the great war of Adventure Time. Probably because she is a genius of some sort and her mom felt that she needed to live forever inside a video game device. But Candy could have lost her memories of Gravity Falls and a majority of her life when her soul became one with BMO. Thus why BMO doesn't talk about much of it's life before Finn and Jake. But Candy's actions are similar to BMO's actions, as in they have the same habits or likes/dislikes.
So did Candy lost her gender after getting her consciousness transferred into BMO, or retain it? Both could be reasonable, since BMO has only had "relationships" with Finn (remember the controller thing?) and Bubble/Air, both male, and BMO has pretended that she/it was a human male and female before.