There have been books written on this topic that don’t cover it exhaustively, so this is going to be summative rather than exhaustive.
This is mostly taken from a lecture that I give as part of my History of Casinos course called “Gambling and Organized Crime” in which I sum up the history of the mob in about 10 minutes.
The Mafia is one element of American organized crime, which itself goes back to the 1830/40s and the formation of professional police forces in American cities. How and why Americans decided they wanted to pay people with guns to walk around and tell them what they could and couldn’t do is a fascinating story (though out of the scope of this answer), but with the rise of regular, uniformed policing came the need for those who operated outside of the law to become more organized. This involved payoffs to police and politicians, and the intertwining of gang leaders and politicians from the ward level to the statehouse Read up on Tammany Hall if you want more about this or watch Gangs of New York.
By the 1860s, gambling bosses—who generally owned shares in multiple gaming houses—had become powerful organized crime leaders. Ethnically, they were a mix of Irish and WASP. Political protection allowed them to operate more or less continuously while any rivals foolish enough not to make accommodations found themselves the target of strict enforcement of anti-gambling statutes. In some cities, gambling syndicates become quasi-official licensing bodies, granting and revoking the right to operate gambling halls.
Meanwhile, neighborhoods in virtually every American city boasted criminal gangs who, as their predecessors going back to the 1830s, specialized in protection, extortion, and a range of other small-scale crimes. Starting in the 1890s, the neighborhoods that hosted “new” immigrants, typically from Southern and Eastern Europe, found that poverty, a contempt for the law, and ambition came together to create ideal conditions for the growth of tightly knit gangs. With Italian immigration peaking, first- and second-generation Italian-Americans were well represented in this group.
The term “mafia’ first came into the public consciousness after the 1890 murder of New Orleans police chief David Hennessy, reportedly by Crescent City mafia members. The murder sparked outrage and the lynching of Italian immigrants, but there was no sentiment that the crime was part of a larger criminal conspiracy (“the Mafia), but rather was the result of local shenanigans in which the chief had interjected himself.
With the advent of Prohibition in 1920, a cohort of ambitious young men, mostly Italian and Jewish, seized power through sheer force of will and firepower. Bootlegging gave them incredible financial and political power, and they absorbed the older gambling syndicates more or less peacefully, creating illegal enterprises with interests in gambling, liquor, labor racketeering, protection, narcotics smuggling, and prostitution. After the end of Prohibition in 1933, gambling became the chief business of these criminal groups.
Up until 1950, Americans did not consider crime to be the province of any one ethnicity and spoke generally of “the rackets” (illicit criminal organizations) and “racketeers” or “hoodlums” (the men who ran these organizations).
It wasn’t until the Kefauver Committee (1950-1) that Americans became aware of “the Mafia” as an international criminal conspiracy. Probably not coincidentally, by making crime a problem that transcended state lines, Estes Kefauver justified his Congressional investigation and staked his presidential aspirations (he went far, being nominated as Adlai Stevenson’s vice presidential running mate in 1956). Later revelations, like the 1957 Apalachin conference and 1960s testimony of Joseph Valachi established that there was some sort of loose confederation of Italian-American criminal elements in cities throughout the country who had diversified from simple vice to control over several industries, including labor “consulting,” waste management, restaurant services, vending machines, and construction.
Early federal attempts to target the Mafia ended in failure, as lower-level criminals were simply more loyal and/or afraid of the mob compatriots than they were of the federal government. But 1970’s RICO (Racketeer-Influenced Corrupt Organization) act led to successful prosecutions of mob leaders, although organized crime as a concept and reality has certainly not disappeared.
Sources:
Development of the Law of Gambling. Washington: United States Government Printing Office, 1977.
Herbert Asbury. Sucker’s Progress: An Informal History of Gambling in America. New York: Dodd, Mead and Company, 1938.
Mark H. Haller. “Illegal Enterprise: A Theoretical and Historical Interpretation.” Criminology, 28:2, 1990. 221.
John Phillip Quinn. The Highway to Hell. Chicago: International Anti-Gambling Association, 1895.
Virgil Peterson. Barbarians in Our Midst: A History of Chicago Crime and Politics. Boston: Little, Brown, and Company, 1952
William H. Moore. The Kefauver Committee and the Politics of Crime, 1950-1952. Columbia: University of Missouri Press, 1974.
Joseph L. Albini. The American Mafia: Genesis of a Legend. New York: Irvington Publishers Inc., 1979.
Ralph Salerno and John S. Tompkins. The Crime Confederation: Cosa Nostra and Allied Operations in Organized Crime. Garden City, NY: Doubleday and Company, 1969.
David G. Schwartz. Cutting the Wire: Gaming Prohibition and the Internet. Reno: University of Nevada Press, 2005.