macOS has several built-in security protections, but it is important to understand both their strengths and their limitations.
Windows-like viruses that self-replicate and spread automatically are not the only form of malware. macOS can be affected by adware, trojans, information stealers, and other malicious software. Its UNIX foundation, permission model, and security architecture provide important defences, but they do not make it immune to malware.
Apple's documentation explains some of these protections:
An important distinction: the sealed system volume protects the integrity of core macOS system files.
It does not protect every file on the Mac.
The writable Data volume includes the user's Home folder, third-party applications, application support files, preferences, and other data.
Malware or a poorly behaving utility can affect these locations without modifying the sealed system volume.
Adware and malware are frequently distributed through deceptive downloads, compromised websites, impersonated applications, and untrustworthy developers. A download hosted on GitHub is not automatically safe merely because GitHub is a legitimate platform.
Source: Apple Support Communities user tip by Kurt Lang:
Effective defenses against malware and other threats
Regarding CleanMyMac
I would exercise caution when using third-party cleaning and maintenance utilities, particularly those that modify permissions, remove system or application files, or make broad changes to the user's account.
Apple Support Communities contains reports from users who attribute application, Finder, settings, and other problems to CleanMyMac. You can review the discussions here:
Apple Support Communities — CleanMyMac search results
Some reported problems involve files and components located in the user's Home folder and Library directories.
These locations are writable and are not protected by the sealed system volume in the same way as core macOS system files.
The existence of these reports does not establish that every installation of CleanMyMac will cause damage.
However, reports of serious or persistent problems should not simply be dismissed on the grounds that macOS has a sealed system volume.
What if a Mac's integrity has been compromised?
If there is credible evidence that an installation or user account has been damaged, and the cause cannot be reliably identified or reversed, I would consider a clean installation of macOS rather than continuing to troubleshoot an untrusted environment indefinitely.
Apple provides instructions here:
How to erase a Mac with Apple silicon
After erasing the Mac, reinstall macOS and reinstall applications from the Mac App Store or the verified websites of their respective developers. Restore personal documents selectively from a known-good backup. Avoid blindly restoring applications, utilities, settings, or other components that could reintroduce the original problem.
A clean installation is a conservative recovery measure, not a requirement for every suspicious download or every reported application problem.
Returning to the original question about MacYTDL
The fact that MacYTDL bounced once in the Dock and crashed does not establish whether it was malicious or whether it successfully compromised the Mac. The request for a passcode is worth investigating, particularly if the prompt was unexpected or the user entered their credentials.
I would recommend updating macOS, reviewing Login Items and granted privacy permissions, and running a second-opinion scan with a reputable security product such as Malwarebytes for Mac. If there is evidence of credential theft or persistent compromise, additional remediation may be necessary.
Apple's built-in defences are valuable, but no operating system or antivirus product can guarantee complete protection. The objective is to assess the evidence, take proportionate precautions, and avoid assuming either that the Mac is definitely compromised or that it is definitely safe simply because the suspicious application has been deleted.