'with' or 'to' are both correct, but there is a different nuance with each.
When you use 'with' you are referring to some relationship with China. You are not referring to China directly.
"The US is losing billions of dollars with [its trading relationship with] China"
With 'to' you are referring directly to China itself and not to some relationship with China.
"The US is losing billions of dollars to China"