The term “wonk” has its roots at Harvard College, where it was used by some students to refer to classmates who study particularly hard. It carries a negative connotation, implying that deep or excessive study is a sign that a “wonk” is not smart enough to understand his studies with only light effort.
The term is now used to refer to politicians, or their advisors, who have deep and substantive understanding of particular issues, as distinguished from politicians who are skillful at pandering to voters looking for easy answers on hard issues.