Homonym
Etymology
From Greek homōnymon, "having the same name," from homos ("same") + onyma ("name"). The literal sense — "same name" — captures it exactly: homonyms are words wearing the same name for different things. It serves as the umbrella term under which homophones and homographs fall.
noun · /HOM-uh-nim/
A word that shares its spelling or sound with another word of entirely different meaning.
What it names
The coincidences that make puns possible — one form doing double duty for unrelated meanings, like the "bat" you swing and the "bat" that flies.
Example
The riddle turns on a homonym: the "bank" you fish from and the "bank" you deposit in.
Related idea
A homophone sounds the same; a homograph is spelled the same. A homonym, strictly, is a word that manages both at once — same sound and same spelling, different meaning.