If you occupy the opponent's factory zone with a land or air unit, the opponent doesn't get to build on that zone. You do.
But the question was for the naval unit. It will be in an ocean zone next to the port zone, not in the port zone itself (it can't go on land).
The American player builds and deploys a new naval piece from the port zone to the adjacent Pacific zone side by side with the Japanese unit. This is the one time he does not attack, when there are opposing units in the same zone, because the "build" phase follows the combat phase. Put another way, the American unit ends its turn by "leaving port" as opposed to "attacking."
On the next move of the Japanese player, that player is deemed the attacker. He has the option of actually attacking (except with a transport), or of retreating the pieces in the hostile sea zone.