WhatsApp has begun testing a new machine-learning security feature that can identify potentially fraudulent messages directly on a user’s phone, as the Meta-owned messaging service seeks to tackle increasingly sophisticated scams without weakening its end-to-end encryption protections.