The same way we got the pronunciation "ate" from "eight." It was a typical English sound shift. In Middle English, the -gh was pronounced; over time, it has become silent and the vowel has also shifted.
It's more usual for the sequence -eigh to be pronounced /ei/ (ay) as in "say" (weigh, neighbor), and Leigh can also be pronounced "lay," but the original word, which meant "meadow, clearing," was so common in place names and personal names that it was frequently reduced to /li:/ (lee). English names ending with -ly, -ley, -lee are generally from the same root.
This message was edited 3/30/2021, 6:31 AM