Hindus and Jains affirm samsara, the beginningless cycle of birth, death, and rebirth through which a being passes according to its karma. The Upanishads articulate the doctrine that the self (atman) is not extinguished at death but takes up a new embodiment shaped by past action, and the Bhagavad Gita likens the changing of bodies to the changing of worn-out clothes. Jainism holds a parallel view in which the eternal soul (jiva), weighed down by karmic matter, transmigrates through countless forms, plant, animal, human, and various classes of heavenly and infernal beings, until purified.
Historians of Indian religion debate where the doctrine itself came from. It is largely absent from the earliest Vedic hymns, which focus on this-worldly blessing and an afterlife in the world of the fathers, and appears fully formed only in the later Upanishads; some scholars, Patrick Olivelle among them, have argued the transmigration doctrine may reflect currents from outside the mainstream Vedic sacrificial tradition, possibly from ascetic or sramana milieus later absorbed into orthodox Hindu thought, while others hold it developed organically from within Vedic speculation about the fate of the ritual self after death. Both traditions elaborate samsara into structured cosmologies of multiple realms of rebirth, heavens, hells, and various non-human states, through which the transmigrating self or soul may pass depending on its accumulated karma.