PIRAEUS, Greece—When state-controlled China Overseas Shipping Group Co. arrived here five years ago, it was met with a month-and-a-half-long dockworkers’ strike and a banner along the waterfront: “Cosco Go Home.”

Today, a new Cosco-built container terminal supports 1,000 jobs, silencing most union unrest. After pumping in a billion dollars and promising another half billion, it has also transformed the port, just outside of Athens,...