Opening email attachments from unknown sources can be dangerous because they may contain malware such as viruses, spyware, ransomware, and other unwanted software that gets secretly installed onto your device. Once malware is on your device, criminals can use it to steal your sensitive information, send you unwanted or inappropriate ads, demand payment to unscramble data encrypted by ransomware, and make your device vulnerable to even more malware.
The general rule of thumb is not to open any email attachments unless you are absolutely sure they have come from a trusted contact and you know what they are. Security software should catch most malware that arrives by email attachment, but it’s not infallible.