In California, there may be some situations where a community college course is given subject credit at a UC, but an AP score for the same subject may not be. For example, some UCs or divisions at UCs do not allow AP scores to fulfill some general education requirements, but do allow transferred college courses to fulfill those general education requirements.
Of course, another aspect is that taking college credit for the course means that it will be part of your college record if you later apply to transfer to a different college or to graduate or professional school.