I'm not certain cities can see them without the aid of a destroyer or another sub. Alas, I'm not great at remembering details but I'm fairly certain in a recent game that I had a sub out side of an enemy city taking three turns to blow up embarked units...

... to get exp. My sub was never attacked by the city until he built/rushed a sub out on his own and it sat inisde the city. If I'm wrong maybe the sub was out of range by a tile, guess I could load it up and find out!