Hi FlorenceK89,
Thank you for using the Apple Support Communities! I understand you are seeing your camera turn on after opening the lid and waking your MacBook from sleep. I am happy to help.
What's great about macOS, is it has built-in security software which means you do not need to install any additional software, such as that anti-spyware you mentioned. Learn more about this here macOS - Security - Apple and Protect your Mac from malware - Apple Support. Let's run through a few tests that can help isolate this behavior.
I'd like to have you boot up into safe mode. It’s a way to start up your Mac so it performs certain checks and prevents some software from automatically loading. Safe mode can take several more minutes to boot into, just to give you a heads up this is expected. Once in safe mode, check to see if the same behavior continues with your camera: Use safe mode to isolate issues with your Mac - Apple Support. Once tested, note the results and restart your Mac to boot back into your normal user. Test for the same behavior again, as sometimes booting into safe mode can resolve some issues.
If the behavior continues, I will have you test a new user account next, to isolate if this is a user-specific issue, or a system-wide issue. Here’s how: How to test an issue in another user account on your Mac - Apple Support.
If you need continued support, reach back out with an update.
Thank you.