If you can choose whether or not to do something, it is optional. Extra credit is always optional; death and taxes are not.
When you buy a new car, you can decide which options or choices, you would like. Things like a DVD player mounted in the ceiling are optional, you don't need them for the car to work, and it's up to you if you want to pay more for them. The opposite of optional is mandatory. If you're in high school, going to bed at 8:00 is optional, for your little sister in elementary school, it's mandatory.