WASHINGTON—Federal deficits are projected to grow much more than expected over the next decade after a budget agreement struck last month, pushing government debt as a share of the economy closer to the highest level since World War II, the Congressional Budget Office said.

The deal agreed upon by congressional leaders and the White House will add roughly $1.7 trillion to deficits between 2020 and 2029, assuming federal spending continues to rise by the rate of inflation beyond 2021. Much of that increase will be offset by...