Moriarty was Sherlock's intellectual equal. A master criminal who enjoyed playing games with the world, he killed himself in order to discredit the detective.