1737, "shaded walk serving as a promenade," generalized from The Mall, name of a broad, tree-lined promenade in St. James's Park, London (so called from 1670s, earlier Maill, 1640s), which was so called because it formerly was an open alley that was used to play pall-mall, a croquet-like game involving hitting a ball with a mallet through a ring. The game's name is from French pallemaille, from Italian pallamaglio, from palla "ball" (see balloon (n.)) + maglio "mallet" (from Latin malleus "a hammer, mallet," from PIE root *mele- "to crush, grind"). Modern sense of "enclosed shopping gallery" is from 1962 (from 1951 in reference to city streets set aside for pedestrians only). Mall rat is from 1985.
The short history of malls goes like this: In 1954, Victor Gruen's Northland Center, often credited as the first modern shopping mall (though earlier examples existed), opens in Southfield, Michigan. The suburban location is fitting because the rise of the automobile, helped along by the Federal-Aid Highway Act, led to the widespread creation of large shopping centers away from urban centers. This, among other factors, nearly killed downtowns, and malls reigned supreme for some 40 years. By the 1990s, however, a new urbanism movement revived the urban shopping experience and eroded the dominance of malls. Next, the rise of big box stores and online shopping sounded the death knell for mall culture. [Steven Kurutz, "An Ode to Shopping Malls," New York Times, July 26, 2017]