In the US educational system you don't get credit for learning on your own. You sit in a classroom, do the homework, take the test(s) and in the end you pass or fail based on how well you do some or all of those things in the opinion of the teacher. You can learn as much as you want on your own time but if it's not part of any class you're taking, you've proven nothing. And unfortunately, proving to the teacher that you know the material being taught is what gets you passing grades, and passing grades get you into good colleges, where you do the same thing except in bigger classes and with more advanced material.
The AP classes/tests are completely optional and not every AP test is accepted by every college for every subject. (How's that for vague?) When I was in HS -- graduated in 1993 -- I took and passed several AP tests (obligatory on topic statement: there was no CS class nor CS test offered at my HS) and this is how the breakdown of college credit worked out:
Passed AP English -- tested out of one semester of mandatory Literature course
Passed AP History -- tested out of two semesters of mandatory European and World History courses
Passed AP Calculus -- tested out of one semester of Calculus for CS majors
Other people I graduated with, who got the exact same scores on the AP tests, reported completely different results, including several who received no credit at all from their colleges. You don't really know that in your Junior and Senior year, especially if you still haven't made a college decision, or even applied, whether the college you pick is going to take credit, and even asking the admissions department may not get you anywhere.
So, why do they take these "crappy" tests in order to learn stuff? Because they have to take the class anyway, as part of the HS curriculum, and if you qualify for an AP class, you probably want to take it, as it is more advanced, over the standard offering, which will have students who do not qualify for the advanced classes (read into that statement what you will.)