A classic of the SF genre.
It's told in an interesting point of view. Omniscient, but sometimes piecing together what might have been from various accounts and legends, and sometimes giving a tight third-person view -- it moves smoothly between them, though.
Off far in the future and into space as well, on another planet, which has been colonized for many generations, a man's mind is rescued from where it was transmitted as self-perpetuating radio-waves. This in a monastery, where Yama is working the technology, despite his fall from the gods. And with Tak, a talking ape, who leaves after a bit to talk with a woman there -- Ratri, goddess of the night. They succeed, though there is a question of reattaching Sam to the world.
Most of the story is told in flashback. Seeking a new body -- they have a way to transmit minds (not brains) from body to body -- Sam, who came with the colony ship, learns how his fellows have installed themselves as Hindu gods, using mind-probe technology to ensure that those who get new bodies get appropriate ones, and those with the wrong views, such as thinking that technology should be diffused from the gods to the rest of humanity, don't. There's a point at which it is explained that the passengers and children of the crew wandered off and became savage, and only now are raising themselves to civilization, not yet ripe for advanced technology. The gods not only have advanced technology but psychic powers. Allegedly, a human can, through good karma and barring accidents, achieve godhood. (I notice that all the gods mentioned seemed to either be from the crew, or children of gods; no one's been promoted. This may just be not knowing backgrounds, to be sure.)
Sam forcibly appropriates a new, sound body and sets out to undermine them. Beginning by becoming the Great-Souled Sam, the Buddha -- at least, the guy who parrots Buddhism with all sincerity. But that is not the end. It involves printing presses, an assassin nursed back to health, questions of enlightenment, a man scorned, an archivist philosophizing on what fatherhood means when both the father and son have been through more avatars since, the original inhabitants of the world who had turned themselves into pure energy beings, a god who claims to feel only friendship for a goddess but who has hunted jackbirds with fervor ever since a lover of hers became one, and much more.