One is a current account, one is a capital account. The US has been running a current account deficit, and the only way to sustain that is to have a capital account surplus, which means foreign investment.
https://en.wikipedia.org/wiki/Capital_account
Just like a business, a country can maintain short term losses by accepting outside investment, or debt. This is not necessarily a bad thing. Almost all companies take on debt and investment to fund their growth.
Also, just like a business, you can’t do this forever. At some point the debt comes due, and/or you end up selling the whole business.