Task groups are bases, and like all base numbering/naming, it's all up to the original builder of that map and in which order he placed the bases on the map.
Some maps have just numbered their bases in a less logical (or intuitive to grasp) order than others. Sometimes the name of the TG doesn't even indicate which port it belongs to. For example on Ozkansas, C203 belongs to P1
As far as I know, there is no direct way to determine which TG belongs to to a certain port. Ask other player or watch where a CV spawns after sinking. Or you can load that map in offline mode to see where all TG'S spawn.