If something's unfair, it's not just or equitable. If your brother carelessly broke your mother's favorite vase, it would be unfair for her to punish both of you.
We all know that when things are fair, they're unbiased or they follow the rules. Unfair is the exact opposite, so an unfair ruling in court isn't based on principles of justice, and an unfair grade on your book report might be due to your English teacher's bias against graphic novels. The original meaning of this adjective was "not lovely" or "hideous," from the "beautiful" definition of fair.