late 15c. from early Middle Dutch luc, shortening of gheluc "happiness, good fortune," of unknown origin. It has cognates in Dutch geluk, Middle High German g(e)lücke, German Glück "fortune, good luck." Perhaps first borrowed in English as a gambling term. To be down on (one's) luck is from 1832; to be in luck is from 1900; to push (one's) luck is from 1911. Good luck as a salutation to one setting off to do something is from 1805. Expression better luck next time attested from 1802.
A gentleman was lately walking through St Giles's, where a levelling citizen attempting to pick his pocket of a handkerchief, which the gentleman caught in time, and secured, observing to the fellow, that he had missed his aim, the latter, with perfect sang-froid, answered, "better luck next time master." ["Monthly Mirror," London, 1802]
by 1945, from luck (n.). To luck out "succeed through luck" is American English colloquial, attested by 1946; to luck into (something good) is from 1944. However, lukken was a verb in Middle English (mid-15c.) meaning "to happen, chance;" also, "happen fortunately."
To get something by luck: Alain lucked into a goldmine with an idea for a magazine (1950s+)