This expression comes from the novel Cervantes’ novel about the ageing gentleman-dreamer Don Quixote. It is a parable about folly, delusion, morality and outdated ideals in a changing world (and more).
It carries many messages, but the tilting bit is a reminder that we should perhaps take counsel or check our facts before entering battle. When Quixote came upon a row of windmills and took them for giants, ignoring all advice he took aim and charged at them. Needless to say the windmills didn’t come off badly in the joust.
“Choose your battles wisely” is sound advice, but before choosing, ask yourself if there needs to be a ‘battle’ at all, and even if there is, is it yours to fight?