The old adage ‘When in Rome’ is as true out in space as it is on earth. Every planet has its own customs and laws, just as every species has its own idea of what is acceptable behaviour and what most definitely isn’t.
Even the Doctor doesn’t always get it right; he’s been wandering through space and time for centuries, yet he still gets himself arrested. Admittedly, sometimes it’s intentional, but more often than not, it’s because he contravened local laws in some way he wasn’t aware of. It’s an occupational hazard.
Travelling with him is nothing if not educational.