Stanley originally comes from the Old English stān lēah, meaning 'stone meadow'. While there are many locations in England called Stanley, the most pertinent is outside the village of Leek in Staffordshire. This is the location that gave the first Stanley, the appropriately named Adam De Stanley, his name. Adam was a thane under King Stephen, and his descendants maintained his surname in good standing. The Stanleys included not a few Earls, and a good scattering of Barons.
As so often happens, the surname eventually came to be used as a popular given name. In America, Stanley reached peak popularity in the early 1900s, just barely making it onto the top 40 most popular name list. It remained in the top 100 until the 1950s, and has been descending in popularity since. It is commonly shortened to Stan, which removes some of the grandfatherly connotations. Stan is slowly moving from being a nickname to being a given name, although Stanley is still more common.
The form Stanlea (pronounced the same as Stanley) is also in use as both a first and a last name. Stanley is commonly used as an Anglicized version of the Slavic Станислав/Stanislaw/Stanislav, although they do not share the same etymology; these names translate to something like 'stand in glory'.