Why does U.S. Veterans Affairs only pay for classes which are required for the degree?
It looks to me like it is more or less required by the legislation, although I'm not a lawyer so I may not be interpreting it right.  Educational assistance is authorized for pursuing a "program of education" rather than just taking individual courses:


  The Secretary shall pay to each individual entitled to educational assistance under this chapter who is pursuing an approved program of education...


A program of education is defined as:


  The term “program of education” means any curriculum or any combination of unit courses or subjects pursued at an educational institution which is generally accepted as necessary to fulfill requirements for the attainment of a predetermined and identified educational, professional, or vocational objective.


Strictly speaking, this doesn't mean the classes must be required for an academic degree per se, and other sorts of credentials or licenses could count.  However, it does not seem to allow taking isolated classes for their own sake, but rather just as required for the overall program.

I don't know the history or why the legislation was set up this way.  I'd guess that it's because the goal is to help veterans achieve qualifications that will further their careers, not to educate them for the sake of education.  One possibility is that nobody really thought hard about the issue while drafting the legislation, so it wasn't a conscious decision.  Another is that it was intended to save money by avoiding paying for frivolous or unnecessary courses.  A third possibility is that it was intended to help veterans by putting pressure on them to follow a set degree program (rather than squandering their benefits on isolated courses that might never fit together to complete any degree).