I'm struggling to find statistics more recent than 2019, but perhaps skipping the anomalous COVID years is for the best. Anyway, in 2019 [0], 89 officers died in the line of duty, of which just under half (44) were due to gun violence. The number of full time police officers in 2019 was in the region of 700k [1]. That's a fatality rate of under 13 per 100,000 - certainly higher than the national average of 3.6, but far less than jobs highlighted as "occupations with high fatal work injury rates" [2] (who are mostly tradespeople or people that operate heavy machinery).
It is well-known that policing is not among the absolute highest-fatality occupations. However, that's beside the point. Airplanes are not the highest-fatality form of transportation (in fact they are quite safe) yet plane crashes grab attention and headlines, as do police fatalities, solidifying the perception of danger and sympathy among the public.