There's no way to have a CD do this on an arbitrary computer, but you can set a single computer up to run something when you insert any CD, if you're running 10.2 or later. In the "CDs and DVDs" preference pane in the system prefs, you can specify either a program or an Applescript to run when you insert a CD (or several other actions).