Pete Hegseth said the cost was a “generational investment” that would strengthen the US military and ensure it did not fall behind rival nations.