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 from The Daily Mirror August 1939:
And then the penny dropped, and I saw his meaning!
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.
British public toilets in 1939 required users to 'spend a penny' in order to unlock the door to get in and that has given rise to speculation that that is the source of the phrase. There's no evidence to support that theory though. Likewise the theory that the expression originated with the 'Button A/Button B' style of telephone boxes, which used coins as payment for calls and which were also in use in 1939.
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.