"Old Mother Leary" takes place in both a fictional and a historical setting, and the two are equally important.
Within the lyrics, a mischievous cow (owned by an assumed-to-be-mischievous Irish immigrant) knocks over a lamp and literally "kicks off" the Great Chicago Fire. The song implies that the either cow or the owner knows what is about to happen, as one of them—it's not clear which—winks and says, "There'll be a hot time in the old town, tonight." Cows don't usually go around winking and talking, and Irish immigrants don't usually go around setting entire cities on fire, but within the fun and flippant context of the song, it all makes sense.
Physically, "Old Mother Leary" is set in Chicago, but Chicago in 1871 was a city with a unique history. The city was only a few decades old at that point, yet it was already the fifth largest in America. Founded in 1829, Chicago quickly grew as a transportation hub linking the Great Lakes to the Mississippi River.
Initially, the primary source of transportation was water; the Chicago River allowed boats to travel west from Lake Michigan into the interior, and with the completion of the Illinois and Michigan Canal System in 1848, vessels could sail all the way from Lake Michigan to the Illinois River and from there to the Mighty Mississippi. Within a decade, however, railroads had begun to replace the waterway as the region's primary source of transportation. With easier access to the large cities of the Northeast, Midwestern farmers expanded production in order to fill the lucrative markets, and East Coast importers and manufacturers flooded the Midwest via Chicago with consumer goods. By 1870, Chicago was a booming city; just a speck on the map in 1830, it now was home to close to 300,000 people.
Yet the rapidity of the city's growth had a downside. The raw sewage that had earlier filled the streets was now channeled into aboveground pipes, but there was still an impermanent feel to the city. The soggy ground near the river could not support heavy brick buildings, so they were made from wood instead. Wood was also used for the construction of all of the poorer houses, and it was the material chosen for all of the sidewalks and many of the streets. An estimated 560 miles of wooden sidewalks linked the thousands of wooden buildings that made up Chicago. After a hot summer, these dry wooden structures snaked through the city like a giant fuse just waiting for the spark that would set them ablaze.