Derived from rhyming slang of Tommy tit, meaning shit, and is directed at what you do in public toilets that are unclean. If you need a shit in a public toilet and it is to dirty to sit down you poo into your coat pocket, or gown pocket hence the Royal connection, to prevent having to touch anything else.

Isabell: What took you so long in the toilets?
Angus: They were rank so I had to have a Tommy Royal.