When you disregard the rules about not wearing sunglasses in school, proudly sporting your purple aviator glasses in math class, you've made a decision to defy — to resist or challenge — the school rules.
To defy something or someone means to challenge some kind of authority. If you deliberately break a rule or ignore an order, you defy, or resist, that rule. The Latin words dis, or "away," and fidus, or "faithful," join together to make disfidare, "renounce one's faith." So if you're expected to be faithful to a certain law or rule but you refuse to be, you defy it.