The penny drops
A belated realization of something after a period of confusion or ignorance.
The Oxford English Dictionary states that this phrase originated by way of allusion to the mechanism of penny-in-the-slot machines. The OED's earliest citation of a use of the phrase with the 'now I understand' meaning, is Nigel Balchin's novel A Way through Wood, 1951:
"I sat and thought for a moment and then the penny dropped."
The image of someone waiting for a penny-in-the-slot mechanism (which often jammed) to operate does sound plausible and, if that isn't the origin, it is difficult to imagine what is.
The usage is surely earlier than 1951 though. Public toilets still then required users to 'spend a penny' in order to unlock the door to get in but, even counting those, coin operated machines were much less common in the 1950s than they were in the Victorian era.
Earlier citations, which make literal reference to actual coins and which are likely precursors of the later figurative use of the phrase, appear in print in the USA from the early 20th century; for example, this piece from the Maryland newspaper, The Daily News, November 1921:
The penny dropped [into the weighing scales], the needle started around the figures, and stopped this time on 150.