I've always taken that line to mean that Kirk's first command was the Enterprise and thus why Gary was with him.
It's open to interpretation and I don't think there is any on screen evidence to really debate it.
That's it in a nutshell. Kirk's first command could either have been the Enterprise
, a previous vessel, or even something else. Take your pick.