: He commands not just a spaceship, Proconsul, but a starship. A very special vessel and crew. I tried for such a command.
There are other places across Star Trek that points to how only a very carefully select few make the captaincy aboard a starship in Starfleet. There's inevitably a thorough psychological screening involved as well. But... it's imperfect. Buried deep within the psyche of a man can be a primal response that will come to the surface under the right circumstances.
Commodore Decker -- became obsessed with trying to destroy the doomsday machine when Spock presented infallible logic on how one starship could not destroy it (without destroying itself in the process), possibly because of all the stress he had been through.
Captain Tracey -- a notable officer who had a fine record for a long while, but when trapped on a planet with his starship stuck in orbit hosting a fully dead crew, he lost perspective and... his inner greed welled up to the surface, compelling him to exploit what might have been the fountain of youth. Driven so madly for this, to kill his own kind without hesitation and attempt to murder a fellow captain.
Captain Garth -- his physiological condition probably warped his mind, allowing his super ego tendency to take hold and cause him to blatantly violate Starfleet regulations.
Captain Maxwell -- lost his family to Cardassians and the revenge urge came to the surface at the breaking point, of driving him to do things no sane captain would ever consider doing (running silent from Starfleet and attacking Cardassian ships at will).
Admiral Pressman -- Pursued a cloaking technology that would give a serious advantage to Starfleet over the Romulans... enough to convince himself that it's OK to ignore Starfleet regulations.
While any man has his breaking points, some are more adept at keeping them at bay. James Kirk is such a man. In Obsession, he did begin to cross a line and violated higher priority orders to make an unauthorized pursuit. While it was a kind of "Matt Decker moment", it wasn't nearly as risky. Kirk wasn't that reckless a captain.