A gambler who has been a really big sinner all his life.
https://freeglobaluniversity.blogspot.com/search/label/Sins
One day he is taking some flowers, betel leaves, and sandal paste to pay a prostitute,
https://freeglobaluniversity.blogspot.com/search/label/BitchProstituteWhore
when he is accosted by robbers who take all his possessions including his clothes, so all he has left are the flowers and the like. He then trips and falls on the ground, whereupon he's knocked unconscious. In the process, he drops the flowers, betas leaves, and sandal paste, making an unintentional offering to Shiva.
https://freeglobaluniversity.blogspot.com/search/label/Flower
When he wakes up, he was filled with remorse for all the sins he has committed in life. Then the gambler dies and goes to Yamaloka, where Yama is ready to give him severe punishments for all his sins, but Yama's assistant Chitragupta informs him that he had made an offering to Shiva and so is entitled to rule in Devaloka for a period of one hour and twelve minutes. So for an hour and twelve minutes, the gambler becomes the new Indra, and out of devotion to Siva he spends his time giving away all of Indra's possessions to various rishis. When the real Indra gets his throne back, he notices all his possessions are gone, and when he finds out what happens he complains to Yama.
https://freeglobaluniversity.blogspot.com/search/label/Indra
Yama chastises the gambler, claiming that according to Hindu scripture charitable giving in allowed on Earth but not in Devaloka. Yama is once again ready to punish th gambler, but Chitragupta says that charitable giving is not a sin even in Devaloka if it's done for the sake of Shiva, and that these actions have freed the gambler from all his sins.
https://freeglobaluniversity.blogspot.com/search/label/Yam
So then the gambler is reborn as Mahabali.
Source
Kedara Kanda of the Skanda Purana
https://freeglobaluniversity.blogspot.com/search/label/Skanda