I don’t think it’s necessary to assume it’s code for anything, other than (as @Monty essentially describes) a term of art in the bureaucracy of the interwar US Navy (and honestly, the pre-WWI US Navy, and really the Army as well). It comes from the limited promotion opportunities available, particularly to officers as the number of commissioned officers who can serve at any particular pay grade are set by Congress. So before someone like, say, Lieutenant Commander *Tom Hanks can be promoted to Commander, a spot needs to open up. That would require:
(a) Someone holding the rank of Commander to die
(b) Someone holding the rank of Commander to retire
(c) Congress to increase the statutorily allowed number of Commanders
(d) Someone holding the rank of Commander to be promoted to Captain (but then see a thru c above, and replace Commander with Captain as the same basic constraints apply)
This is, by the way, essentially still true today. But today, officers who don’t get promoted are more likely to be… well, you know how Hanks was founded “fitted but retained”? The “fitted” part means found to have possessed the minimum qualifications for promotion (as we today would call “fully qualified”). The “retained” part means, not promoted, (and so not, as we might say “best qualified”) but also not kicked out. Just drop the “retained” part and you’ll see where I’m going. Or at the very least, someone passed over for promotion a number of times will not be retained all the way to 62 (or whatever the statutory retirement age is). They will either be separated from the military if they’re a junior officer without many years in, forced to retire at 20 years of total serve if they’re a Lieutenant Commander (or heir landed equivalent), or forced to retire at one of a number of other statutory limits applicable to the grades of Commander and Captain.
Point being, back in the day, the military was much more likely to “retain” officers who were “merely” fit to continue serving, but with the down stream effect of making it much harder for more junior officers to promote (because someone staying in at a higher grade was… allowed to stay in at a higher grade instead of opening a spot up).
So the truth is, probably the majority of officers in Lieutenant-Commander-turned-Commander Hanks’ situation would have been “fitted but retained” or the like many times throughout their mid-career, and then only promoted with the rapid wartime expansion (and looking forward to Hanks’ future, he might well have spent only a year or two as a Commander, and then been rapidly promoted to Captain and into the grades of Admiral).
If fitted but retained is code for anything, it’s code for “sorry, you’re just like everyone else.” Not special. Not god’s gift to the Navy. Not even a monster or a drunkard or a fool. Just like everyone else who has to wait their turn (or, as West Point cadets even wrote into the lyrics of one their songs, for war to come and “the army be augmented, promotion be less slow”). It speaks to his insecurity, not to any particular flaw in his character or ability (except, again, that he may be merely human, like everyone else).
Nevertheless, Hanks, like a great many people who join the Navy in their youth, fueled by lines like “I have not yet begun to fight!”, “Damn the torpedoes, full speed ahead!”, and of course those immortal words “The needs pf the many outweigh the needs of the few or the one,” it can then be a bit deflating, even demoralizing, to fine oneself in a long peace, without much opportunity for distinction, and nothing to force one’s more senior officers out (or to at least open up the flood gates to move past them).
*I have read the book and seen the movie. For the life of me, I cannot remember the main character’s name, or if he even had one. Which is perhaps the point. Part of being “just like everyone else” is being a good stand in for the Everyman.