Gary Mitchell became a god after he was assumed long dead. Kirk wants to know what Gary Mitchell knows. He is an explorer, catnip. Gary was once an explorer, now he is worshiped by cultures for his knowledge, and hates it. Gary does what every God does when he wishes to punish us--he grants our wishes. Kirk learns the ultimate knowledge of Gary Mitchell, and asks him to remove it, going through all the stages of mourning of no longer exploring. He does this to anyone who worships him, in vengeance. They all have differing reactions. Gary is ended by another god he created, in his wrath. This power-seeking god is destroyed by the followers of Gary Mitchell, the worshipers left after Mitchell's wrath. Kirk forgets all his knowledge, the events questioning whether he'd like to explore, again.
The references to the characters, just stand-ins for the concepts.