From a comms perspective what you need is a technique called Multiplexing. This technique has been around since the telegraph and in general terms allows one to share multiple signals on a single 'line'. In the case of your nanobots, this is probably a single wireless channel.
The link provided talks about the different types of multiplexing techniques and I don't believe that there is one among them that will easily manage up to 50k streams, but it's possible even if you have to split the units up into multiple channels to communicate with them all as a whole.
As for how you get them all to do your bidding as a single unit, there is no way you can individually control that many drones to operate as a single hand by programming them individually in real time. That said, it will be possible to record a set number of 'patterns' or tasks into your drones, and manage them macroscopically, so to speak. In other words, you can issue a command like 'grab thing at this location from North' and the drones will be given the commands that render that effect.
Another way to put this is that to make your drones useful, you have to surrender some of their flexibility by functionalising larger tasks, then sending signals that tell the swarm what to do as if it was a single unit. That then allows the software that renders the function to design a multiplexed signal that tells each drone what part of that function they need to perform.
In short, it is certainly possible with existing techniques, if not existing technology, but to do it you have to build an abstraction layer over the top of the drones that treats commands to them as a single unit, rather than trying to get creative and building a bespoke drone configuration for every task. Over time, your knowledge and experience will develop to the point where you end up with more sophisticated and configurable functions and tasks as an asset base of actions for the drone swarm but ultimately what makes it useful is that abstraction layer that interprets what a swarm function means to each individual drone and sends out the commands accordingly.