How do college credits work?

Again, it depends upon the college. Just google: AP Credit Policy for “the name of the college” and you will get the information you are asking about.

Here is UC Berkeley’s AP Credit Policy as an example: http://admission.universityofcalifornia.edu/counselors/exam-credit/ap-credits/berkeley/index.html