Why do bad things happen to good people?
one life is a short window; karma, the nature of the world and growth through suffering all play a part.
Hindu thought gives several answers, held together. First, karma works across lifetimes: prārabdha karma, the portion already set in motion, may bear fruit now even for someone living well today. Second, the world of change is by nature mixed — the Gītā calls it temporary and full of sorrow, and says heat and cold, pleasure and pain come and go (2.14). Third, hardship can deepen us: Kuntī in the Bhāgavata famously asks Kṛṣṇa for difficulties, because in them she remembers Him.
One caution is essential. Karma explains our own lives to ourselves; it must never be used to judge or blame someone who is suffering. The right response to another's pain is compassion and help, not theory.
The saints also show that goodness is its own reward. The good person may suffer outwardly, but their inner peace, character and closeness to God are real gains that misfortune cannot take.
Source: Bhagavad Gītā 2.14; Bhāgavata Purāṇa 1.8 · Prārabdha: karma already bearing fruit
Dharma Q&A — Jyotiṣa, scriptures & modern life · Ask a Jyotishi your own question