To earn the Don't Mess With BD-1 trophy, you need to first unlock the Droid Hack ability. You will the ability to hack Probe Droids in normal story progression after you complete the Tomb of Miktrull on Zeffo – the second tomb which is unlocked on your return visit.
Once BD-1 has been upgraded at the bench, head to any area with Probe Droids (there are plenty at Crash Site on Zeffo), and Force Pull it towards you. You will see a D-Pad down prompt, which causes BD-1 to jump on the Probe Droid and hack it to become friendly. The trophy should unlock shortly after.
You can also unlock the ability for BD-1 to hack the tougher humanoid Security Droids. The ability is found on a bench in the Imperial Refinery, above one of the rotating sap whisk platforms that you have to cross (it's the one just after leaving the Forest Trench).
Now you can track down a Security Droid in the Refinery, whittle it down to a quarter of its health and look for the same D-Pad down prompt to have BD-1 hack it for friendly use.
You can return after the story at any time to unlock this, but if you are heading towards the end of the game there's an area in which it is extremely beneficial to use the hack on several Security Droids anyway – so it's highly likely that you will unlock this trophy through natural progression.