What does "spend a penny" mean — and why is it funny?

informal, British, dated

Meaning

A polite, old-fashioned way of saying you are going to use the toilet.

Where it comes from

From British public toilets of the 1800s and 1900s, whose cubicle doors had coin locks that cost exactly one penny to open.

Why it is funny

The humor is the prim delicacy of it. Rather than name the act, the phrase quietly turns a trip to the toilet into a small, respectable financial transaction.

Used in a sentence

"Excuse me a moment — I need to spend a penny."