BMW has a special tool that slides in the CD changer that can help release a jammed cartridge. This might be the only way to eject this.
However, the one thing that you can try is to reset the CD changer by disconnecting the battery for a short time. If the problem is in the CD changer module a reset will sometimes restore functionality. The battery is access from the right side under the side panel. You have to remove the jack and a plastic cover under that. You only need to disconnect the negative side for 10 minutes and then connect and re-tighten. Make sure to leave the vehicle unlocked and the trunk open to prevent any problems re-accessing the battery and entering the vehicle.
I hope the reset works but most likely the special tool will be needed.
I hope this is helpful. Please accept and thank you.