Aschenbach's dream is one of the most fascinating and horrifying episodes in Death in Venice. It functions on multiple levels of meaning in the story, and Jungian concepts can be applied to all of them.
The dream in some way represents both the shadow and the collective unconscious. Aschenbach's repressed desires are at the core of the story. Though most readers today would simply interpret his behavior as that of a gay man who has not come out yet and has sublimated his true nature and is in denial about it, Jung would see this as the manifestation of the anima, the feminine element within a man. It's significant that Aschenbach is not only gay but appears to be a pedophile in his obsession with Tadzio. His nature is therefore not just a violation of the sexual moral code of his time, but also has a potential for criminal acts that could victimize a young boy. In the dream, however, the collectively repressed spirit of society as a whole is revealed. The "civilized" code by which not only Aschenbach but human beings in general live has fallen away and been replaced by a primitive savagery. The setting of the dream is the landscape Aschenbach recognizes as that of his home in Germany. This unconscious desire—in this case, that of reverting to primitivism, as those in the dream are doing in their worship of the "stranger god"—would be interpreted by Jung as the collective unconscious, because it is shared by society as a whole. Aschenbach's personal repression is an individual occurrence of a generic, buried desire, which Mann sees as lurking behind the facade of European civilization.
The cholera epidemic sweeping across Venice is a metaphor of the mental/emotional condition of Aschenbach's, and society's, illness of repression. It is something the authorities in Venice are keeping a mystery. "They are disinfecting Venice," Aschenbach asks. "Why?"
The secret mirrors the secret within Aschenbach himself as to his true nature, which would be interpreted by Jung as the shadow: the inner, unacceptable desire that animates a person. Just as the controlled and unemotional persona Aschenbach has maintained throughout life is a mask or facade covering his wild and potentially destructive tendencies, the veneer of civilization (and in Venice, as the story is taking place, the fiction that all is well and that no threat to the health of the citizens exists) hides the potential that human beings possess for the reversion to our primitive ancestors, as shown in the dream.