The phrase "spend a penny" in British English means to urinate. For example, before leaving the house, someone might say "please wait, I need to spend a penny", or asking a child before a long journey, "do you need to spend a penny?".
The origin of the phrase is public lavatories in the past requiring visitors to pay to use them, especially for women's toilets, specifically by placing a penny coin in a slot to unlock the door. However, the phrase evolved to become equally applied to men and women, and expanded to include urinating at home or anywhere else, not just at public toilets.
The phrase has declined in usage over the past few decades, but is still used among the older population of Great Britain.