Swami and his friends live in the small town of Malgudi in Southern India. Narayan often uses this fictional place as the setting for his stories. In creating Malgudi, Narayan builds on his own childhood experiences of the place where he grew up, the people he met, and the boys he played with. In Swami and Friends, Malgudi is presented as an idyllic, magical place, the perfect backdrop for the boys' various adventures and escapades.
At the same time, Malgudi, rather like Mark Twain's St. Petersburg, is not immune to the social and political tensions of the adult world. We can see this, for example, when Swami joins a large, angry mob protesting against the arrest of a prominent local politician. He becomes so intoxicated with the mob's nationalist fervor that he throws a rock through the window of his headmaster's office. Thankfully, Swami sees the error of his ways and channels his youthful aggression into a rather more civilized pursuit—cricket.