Something that's elective is optional — you can choose to do it, or not. An elective course in school is one you take because you want to rather than to fill a particular requirement, although you still get credit for it.
You can take elective classes in high school or college. In fact, the word elective is sometimes used as a noun, to mean "optional class." Also, if someone has elective surgery, that means he’s getting an optional operation, like a nose job or a face-lift. In either case, nothing is required or compulsory — it's a free choice. The word comes from the Latin electivus, by way of eligere, "pick out or select," which is also the root of election.