Apple says to plans to hire 20,000 people and build a new server factory in Texas as it vows to invest more than $US500 billion in the US amid tariff threats.