It can be 2 reasons.
1. Hardware issue
2. Virus/malware infection
Boot the computer to BIOS screen and check if the CD drive opens on its own or not. If it does not open then it is confirmed your computer is infected. But if it opens then try reseating its cables and check. If it does not work replace the drive.