Ajax went mad and tried to kill Odysseus and other Greeks. Athena intervened and made him see Greeks where there were really cattle. When Ajax recovered, he was mortified by his deeds, although still aggrieved by the slight, and so killed himself using the sword Hector had given him.
Why was Ajax killed?
He competed with the Greek hero Odysseus for the armour of Achilles but lost, which so enraged him that it caused his death. According to a later story, Ajax's disappointment drove him mad. On coming to his senses, he slew himself with the sword that he had received as a present from Hector.
What happened to Ajax in the Odyssey?
Ajax's Death
At the end of the Trojan War and after Achilles' death, Ajax along with Odysseus fought against the Trojans to retrieve the body of the hero. After burying him, the two wanted to claim Achilles' armour for themselves. ... Ajax, angry at what had happened, deliberately fell on his own sword and died.