Yes. In general people avoid giving any attention to their competitors, so marketers typically say “50% better than the most popular toothpaste” (if you’re an underdog) or “the #1 product, used by twice as many people as the competition”.
But that’s a convention. You can absolutely use competitors trademarks as long as it doesn’t create confusion. The Pepsi Challenge is a famous example. Microsoft’s lame “I’m a Mac” ads are another.
I think Apple's original message was something along the lines of, "You can't get malware on a Mac", but the subtext would have been, "Only because we have so little market share that the scammers wouldn't waste their time developing it."
Eh, I don’t think that was the message. And at the time Macs were far far more malware-resistant than Windows. There are better complaints about Apple.
If people actually wrote viruses for Macs they would have ran just like Windows. The expense and rarity of Macs at the time in hands of people that wanted to write programs drastically reduced the number of attacks.