This is a colloquial expression, meaning that someone has suddenly understood something. It is probably derived from the old public telephone machines in Britain, where you put in your money [a penny or two] in the slot to make a call, but the money did not drop into the collecting box until the connection was actually made. So, I might use the phrase as follows, "I could not understand why Marilyn preferred Jim to me. Then I saw him pick her up in his Rolls-Royce, and the penny dropped".
:up: ... but my guess for the origin would be the coin-in-the-slot locks on public lavatories (which used to take a single penny piece - .d, as in £.s.d., not p)*. Or maybe coin-operated games, into which the punter dropped a penny and moving shelves shunted previous punters' offerings ever closer to a pay-out. Anyway, coin-operated machines of some kind.
PS This where the euphemism 'spend a penny' came from.