* Merkel says China-U.S. trade war affecting whole world
* Eyes EU-China investment agreement in 2020
* German, Chinese companies sign cooperation agreements (Adds companies signing agreements)
By Andreas Rinke
BEIJING, Sept 6 (Reuters) - German Chancellor Angela Merkel said at the start of a visit to Beijing on Friday that the China-U.S. trade war was affecting the whole world and she hoped it would be resolved soon.
Germany's firms have been caught in the crossfire of a U.S.-China trade conflict, its economy - Europe's largest - contracted on weaker exports in the second quarter, and leading economists say it is facing a recession, especially after weak industrial data published this week.
But while U.S. President Donald Trump has pressed American companies to look at ways to close their Chinese operations and make more of their products at home, Merkel wants to start a new phase in the European Union's relations with China.
"We hope that there will be a solution in the trade dispute with the United States since it affects everybody" in the world, Merkel told Chinese Premier Li Keqiang at Beijing's Great Hall of the People during a two-day trip to China.
China and the United States are due to resume trade talks this month, with more senior consultations next month in Washington.
Merkel has pushed for a European investment deal with Beijing, even as Washington has resorted to waves of tariffs to counter what it says are China's unfair trade practices. The United States' European allies, including Germany, largely share its criticisms of China, but not Trump's choice of tariffs to resolve the issues.
Merkel said Germany is open for Chinese investment and she welcomes all Chinese companies to invest in the country. However, she added that Germany checks investments in certain strategic sectors and critical infrastructure.
Li said that China hopes Germany will accept more Chinese companies and loosen export rules for certain goods.
Germany, which traded almost 100 billion euros ($111 billion) in goods with China in the first half of 2019, holds the rotating EU presidency in 2020, when Merkel is planning an EU-China summit with a view to achieving a common European stance toward the world's second-largest economy.
Referring to an EU-China investment agreement, Merkel said that Germany was hoping "that we can perhaps finish this project" during its EU presidency in the second half of next year.
That summit would aim to counter what Berlin sees as China's divide-and-rule approach to dealing with the European bloc, as Beijing promotes global infrastructure projects under its Belt and Road development initiative that has made it an influential player in poorer eastern EU countries, such as Hungary and Greece.
Several companies signed agreements as Merkel and Li met, including Airbus - which came to an arrangement with China's AVIC Aircraft Corporation on assembling A320 planes in China - and German insurer Allianz, which wants to work more closely with the Bank of China.
German engineering group Voith and CRRC said they wanted to cooperate on electric buses and Siemens signed a memorandum of understanding with China's State Power Investment Corporation Limited (SPIC) on developing gas turbines and cooperating on the use of hydrogen.
Ahead of her departure for China, prominent Hong Kong activists wrote to the chancellor urging her to be guided by her memories of life in dictatorial East Germany, and to be on her guard in her talks and business dealings with Beijing.
Hong Kong leader Carrie Lam on Wednesday withdrew an extradition bill that triggered months of often violent protests in the Chinese-ruled city, but some protesters said the move was not enough. (Reporting by Andreas Rinke; Writing by Michael Martina and Ben Blanchard in Beijing and Michelle Martin in Berlin; Editing by Jacqueline Wong and Michael Perry, William Maclean)