plas1, welcome to Apple Discussions.
The problem could be due to some add-on device plugged into the computer. In particular, a malfunctioning mouse or keyboard could be sending a signal to the system to eject the disk.
To solve this problem, unplug all external devices and restart the computer to see if the problem still occurs. If the drive does not pop open or eject the disk, then one of the devices plugged into the computer was causing the problem. Take the keyboard by itself and plug it into the computer, then restart the computer and see of the drive opens or the system ejects the disk inside; if it doesn't, plug the mouse in and restart again. Continue to add the equipment back onto the computer one piece at a time and restarting until the drive opens or the system ejects the disk; the last piece of equipment added to the system is responsible for causing the drive to open.
Cheers, Tom 😉