No contradiction there, the competition comes from the other country. It's the same in companies competing domestically too. Within the company, resources are shared and divided in a top-down approach, everyone working to a common goal, using the company's funds to do so. Externally, companies compete with other companies.
I once heard the saying that companies are communistic internally and capitalistic externally.
This pattern seems to stem or be consistent with how humans cooperate and compete, according to Realistic Conflict Theory: https://en.wikipedia.org/wiki/Realistic_conflict_theory
---
That said, companies competing have overall done a lot less harm than nations competing. At least companies can't declare war on each other, collect taxes, or execute/incarcerate people.