Bhagiratha’s story is part of the myth of the coming to earth of the Ganga (Ganges). These interlocking stories gave Bhagiratha a great royal lineage, with prior events in that lineage requiring him to do a thousand years of austerities (tapas) in order to ask Siva for a boon. And all this explained the coming down to earth of the Ganga.
Bhagiratha’s great-grandfather, Sagara, had two wives and sons from each. All 60,000 sons of one wife were killed by the sage Kapila as they disturbed his rituals. Indra had stolen the sacrificial horse that King Sagara had been using in the battle before the asva-medha (royal horse sacrifice) and hid it near Kapila’s place for rituals. The warriors’ noise, upon their discovery of its hiding place, ended their lives. But a proper burial was not possible for lack of water, so neither Bhagiratha’s grandfather or father could complete their duty. In order to obtain enough water Bhagiratha worshipped the celestial river goddess Ganga. She appeared and told him that her descent to earth would destroy it in a worldwide flood. Ganga told Bhagiratha to ask Lord Siva’s help. So to get Siva’s attention, Bhagiratha did austerities (tapas) for a thousand years, and Siva allowed the river to fall on his head and go through his matted hair. After another thousand years none had reached the earth. So Bhagiratha worshipped Siva fervently, and Siva shook a single drop of the celestial Ganga from his own matted hair. That became the mighty earthly Ganga with sufficient water for Bhagiratha to complete the burial rites of his ancestors.