Aokiji might have his own self justice principles. As he has previously seen the unjustice rendered by the present fleet admiral to the innocent people of Ohara when Aokiji and Akainu are fellow comrade Vice Admirals in the buster call operation, he might feel indignant to work under a person (Akainu) who has the pretence of killing innocent in the name of justice as they contradict with his own self justice principles. So he might have decided to join hands with Black Beard who proclaims his evil intentions to the world rather than pretending to be someone.
But why he joined hands with Black Beard is the mystery. Maybe Black Beard might have given him an approbation of making Aokiji the Fleet Admiral after he himself took the world dragons under captives and make Black Beard himself the new World Ruler. Simply a cruel, arrogant person is more detestable than a cruel, friendly person. Or he might be sick of the marines' overall cruel operations to safeguard the world government who follow tyrannical measures.