To spend a penny is an informal, euphemistic way of saying you are going to the toilet to urinate.
This phrase has its origins in paying a penny to use a public toilet.
Today, it costs more than a penny to use a public toilet but this phrase has stayed the same.
Examples of use:
1. Can we stop the car soon? I need to spend a penny.
2. I'm nearly ready to leave. You put the bags in the car while I go and spend a penny.
Image by donjd2