This might happen because you accidentally turned OFF this option. To re-enable it on your Mac, go to System preferences > CDs & DVDs. You should be able to find the option that controls what happens when media is inserted into your computer and turn it ON.