The image dates to May 28th, 2007 - and no port visits are recorded on this date in this port (nor anytime+anywhere close).
The submarine is too short to match the Brazilian navy submarines, SSN or one of the new air-independent-propulsion submarines. Diesel-powered submarines are not made for long transatlantic voyages, so this must be a sub from South America. Argentina, Peru and Colombia operate Type 209/1200 submarines, which fits the length of this submarine. It is most likely an Argentinian submarine, leaving only one choice: the S-31 Salta."