This term has two, slightly differing, but related meanings: 'whether it is with or against your will' and 'in an unplanned, haphazard fashion'. We tend to use the latter of these meanings today; the former was the accepted meaning when the term was first coined.
...The early meaning of the word nill is key to this. In early English nill was the opposite of will a contraction of 'ne will'. That is, will meant to want to do something, nill meant to want to avoid it.
1. Aelfric's Lives of Saints, circa 1000: "Forean the we synd synfulle and sceolan beon eadmode, wille we, nelle we."
2. The Taming of the Shrew:
Petruchio: [To Katharina]
Thus in plain terms: your father hath consented
That you shall be my wife; your dowry 'greed on;
And, Will you, nill you, I will marry you.