The story
Lamb has hardly changed its spelling in over a thousand years: Old English wrote it lamb, just as we do. What changed is the sound. In Old English the final B was pronounced — the word ended "-mb", with the lips closing for M and then releasing a B. German and Dutch, which share the word, say Lamm and lam.
In later Middle English, speakers reduced a word-final -mb to plain M. The B was silent from then on in lamb, comb, climb, womb and plumb. The letter stayed, because spelling had settled before the sound was lost.
A good rule of thumb: an -mb at the very end of a word is always silent in modern English — and it usually stays silent when an ending is added (lambing, climber, plumber).
