FRANKFURT—German companies are sitting on a half-trillion dollars of cash but are reluctant to invest it in their own country, potentially threatening the country’s competitive edge and European economic growth.

Germany’s nonfinancial businesses have saved more than they have invested for the past seven years, piling up about €455 billion ($500.4 billion) in cash and deposits, German central bank data show.

Executives...