Apastamba Dharma Sutra - Prasna 2, Patala 7
Saha devamanushya asmin loke pura babhoovuh. Atha devah karmabhirdivam jagmuraheeyanta manushyah. Tesham ye tatha karmnyarabhante saha devairbrahmana chamushminloke bhavanti.
Formerly men and gods lived together in this world. Then the gods in reward of their sacrifices went to heaven, but men were left behind. Those men who perform sacrifices in the same manner as the gods did, dwell (after death) with the gods and Brahman in heaven.
Going by the above, it can be said that Gods are men who reached heaven by virtue of their meritorious deeds such as yajnas. This must be the logic behind accepting the puranic heroes as Gods subsequent to their reaching heaven. While they were human beings, they performed human tasks like fighting wars and protecting mankind and became Gods at the end of their earthly life.