Defense has to do with protecting something or fighting against an opponent, whether it's national defense, a football team's defense, or a defense lawyer.
Defense is the opposite of offense. It has to do with defending against all sorts of things: In the military, defense is about protecting a country from attack. In sports, defense is supposed to stop the other team from scoring. A defense attorney tries to prove his client is innocent. A defense can even be an excuse for doing something, as in "In my own defense, I was sleepwalking at the time."