If you've forgotten where did he get the sex change and how the revert works read chapter 7 & 8. Judging from this chapter apparently nanomachines are unstable so random unintended sex change happens from times to times.
Side note: In chapter 6 the Yakuza(?) who took a liking to Bub/Daniel had a tattoo of the 4th dimension man on his back. And speaking of Karellen who mentioned in chapter 4 that she was giving gadgets and stuffs to civilizations, just like 4th dimension man.
Guess the world goes round and round, just like a conveyor belt sushi.