Is there a term for referring to an organization by its city rather than by its name?
Solution 1:
You may be looking for metonymy.
If you're looking for other examples, governments are often referred to like this—at least, Westminster for the UK parliament, and Washington for the US government. (In fact, looking up Westminster on Wikipedia was how I found metonym.)
Solution 2:
This is an example of synecdoche.
In these examples, the company HQ is a part of the city as a whole. The city is being used as a metaphor for the company.
I wonder if these are being used in a slightly euphemistic way. It allows one to refer to the company without referring to directly, perhaps granting license to say something negative about the company with imagined impunity.
Solution 3:
To answer the question of difference between Dancrumb's synecdoche and John Bartholomew's metonym, Wikipedia describes it thusly:
When the distinction is made, it is the following: when A is used to refer to B, it is a synecdoche if A is a component of B and a metonym if A is commonly associated with B but not actually part of its whole.
Redmond and Cupertino are not part of their associated companies. Therefore, metonym is the more appropriate term. Furthermore, both appear on the list of metonyms.