He was in charge of the executive protection team. They are armed because leaders of well known companies face constant threats and are kidnapping targets (Apple would obviously pay countless sums to get Tim Cook back safely for example).
The Bay Area and New York are notorious for withholding permits because it creates artificial scarcity, and off-duty cops are the only ones able to fill the demand.