He was corrupted by rage. That's a major theme of the movie - the purity of will. Thanos wanted to commit an atrocity, but his intent was absolutely pure. He wasn't motivated by revenge or hate, just genuine desire to help. Thor wanted revenge. Star Lord lost his mind in rage. They paid the price for letting their purpose become corrupted. Thanos remained pure and won.
Strange also did by letting half the universe including himself die for the ultimate victory later. "It was the only way."