From the episode Elaan of Troyius:
MCCOY: Did she cry? Did her tears touch you at any time?
(Kirk looks at his hand.)
MCCOY: Oh, we’re in trouble. Now listen, Jim. Petri told Christine that the Elasian women have a sort of a biochemical substance in their tears that acts like a super love potion. And according to him, it doesn’t wear off.
(later…)
MCCOY: Spock, I’ve isolated the biochemical substance of the Elasian tears. It’s a kind of an infection, and I think I’ve found an antidote.
SPOCK: You are too late, Doctor. The Captain has found his own antidote.
MCCOY: Are you out of your Vulcan mind? Do you know how long I’ve worked on
SPOCK: The antidote to a woman of Elas, Doctor, is a starship. The Enterprise infected the Captain long before the Dohlman did.
So basically- Kirk is infected with a ‘love potion’ but he overcomes it’s affects because his love for the Enterprise supersedes it.
Kirk loves the Enterprise a lot. A lot a lot.
And here is this lovely gif set showing Kirk sacrificing the Enterprise to do what Bones says: What you had to do.
And later:
SAREK: Kirk. I thank you. What you have done is…
KIRK: What I have done, …I had to do.
SAREK: But at what cost? Your ship. Your son.
KIRK: If I hadn’t tried, …the cost would have been my soul.
It’s just…these guys! and their love and their sacrifices for each other. And how they say they love each other by stealing a starship and setting it ablaze over a dying planet.