According to the MCU Wiki:
Thanos is the genocidal warlord from Titan, whose own main objective was to bring stability to the universe, as he believed its massive population would inevitably use up the universe's entire supply of resources and condemn it.
He costed everything for this noble cause. However, he's intelligent enough to know that the universe will become imbalanced again with the population explosion. Did he think of this scenario and gave duty of snapping gauntlet every "X" years to some eternal being?