These trials are called Labors of Hercules.
Hercules offended the gods, simply by being born - he is a demigod, the son of Zeus and a mortal woman. This obviously angered Hera, who goaded Hercules to kill his wife Megara and their children. In order to redeem himself for his sins, he was ordered to complete 12 trials over the course of 12 years.