Going only by TOS, not the comics or novels.
OF all the enemies Kirk and crew faced, which was Kirk's greatest foe?
1. Khan: easily took over the ship, came back 15 years later, thoroughly insane with a hijacked starship and the Genesis torpedo. Blew holes in the Enterprise, killing some crew and did kill Spock or at least created the circumstances for Spock to sacrifice himself
2. Squire of Gothos: basically a precursor to the Q, imo. Also there is a novel that reveals he is indeed an adolescent Q. All that cosmic power, can move planets and seize the Enterprise, but also a juvenile
3. NOMAD Probe: can wipe out star systems, thinks all life is imperfect. Mistakenly thought Kirk was his creator which led to Nomad's destruction.
4. V'ger: basically an upgraded Nomad probe concept but was quite deadly and also had an adolescent mindset
5. The M5 computer: controlled the ship, could have shut down life support and killed them all, did destroy one starship in the war games and damaged the other 3
6. Commander Kruge of Star Trek 3: willing to fight Kirk on an exploding planet. Takes some guts and insanity to do that.
7. Harry Mudd...a conman with a lot of resources and chicanery. Was considered a suspect by Spock in the abduction of Kirk's body in the Shatnerverse novels. If Mudd gained control over all those androids he could have had an army to use at his command.
8. The Doomsday Machine: came from outside the galaxy, true purpose unknown (read the TNG novel Vendetta)can blast apart planets, indestructible hull, a few blasts from it can take down a starship's shields and a few more blasts leaves the ship a crippled wreck. stopped only by riding a fusion bomb into its gullet, possibly could be reactivated and there may be more of them.
To me his greatest foe is indeed Khan.
Those are all good picks. It also made me think of Captain Garth, an experienced starship Captain who was insane and could shapeshift. Imagine if he got off the prison planet.
There was the cloud from "Obsession." It could fly through space, enter ships, drain peoples' blood. It was about to reproduce into thousands according to Spock. If they hadn't stopped it right there it might have spread across the quadrant.
If Kirk hadn't killed Gary Mitchell before he completed his transformation he would have been unstoppable.
Man, there should have been a Star Trek "What If" series at Marvel.