An American nuclear-powered submarine has docked off the Western Australian coast.