"Gary Seven" is his code name, according to dialogue.
True. But I always interpreted that in the context of the fact that he was part of a multi-generational covert operation. I accepted the idea that he was assigned his code name at birth. And to find out why I made that leap, you'll have to ask preteen CorporalCaptain
; it just seemed right to me.
After all, would the name "Gary" have existed 6,000 years ago when his ancestors were taken from Earth?
No, but Gary's aliens obviously kept up with the times, and could have named the subjects. I don't see why Gary, at least, can't be his given name. It's not like he actually needs an alias for the sort of reason that, say, the spies on The Americans
Perhaps Gary 7 is the prefix to a much longer alphanumeric identifier.