Use a paper clip or suitable piece of straight wire, and insert it in the ejection pin hole, and press the wire lightly while pressing the CD/DVD Eject Button. It can also be done without pressing the eject button, just pressing harder on the wire/paper clip to force the tray open, but the button helps.
Some drives don't have the eject pin hole so if that's your case, you'll have to remove the CD/DVD Drive to manually extract the CD. If necessary, your computer model may help find the procedure to remove the drive.
Manually remove stuck DVD from any drive
http
/www.blogtechtips.com/2016/08/21/manually-remove-stuck-dvd-drive/