Inherence is the existence of accidents of a substance, while subsistence is the existence of the substance itself. Accidents are defined as the determinations of a substance, while a substance is that which is determined by accidents.
Substance/accident is an a priori pair of concepts, in that it cannot be thought away from our empirical concept of any object (B6). "If we remove from our empirical concept of any object, corporeal or incorporeal, all properties which experience has taught us, we yet cannot take away that property through which the object is thought as substance or as inhering in a substance (although this concept is more determinate than that of an object in general). Owing, therefore, to the necessity with which this concept of substance forces itself upon us, we have no option save to admit that it has its seat in our faculty of a priori cognition" (B6-7).
The basis for these concepts is to be found in logic, specifically in the logical concepts of subject and predicate, which together with the copula make up a form of judgment. As a "form of thought," substance is that which "can exist as subject but never mere predicate" (B149). Correspondingly, an accident would be that which exists as predicate but never as subject.
We cannot apply the concepts substance/accident to any object but appearances, objects in space and/or time. For example, we might try to apply it to ourselves as thinking beings. "In all our thought the 'I' is the subject, in which thoughts inhere only as determinations; and this 'I' cannot be employed as determination of another thing. Everyone must, therefore, necessarily regard himself as substance, and thought as only accidents of his being, determinations of his state" (A349). This application of the category of substance is empty, however, unless it states something about the persistence of substance over time. Hence, it is of value only when applied to appearances. The mere representation of ourselves as thinking does not yield any information about our temporal properties. (This is argued in the First Paralogism.)
The application of the category of substance to appearances takes place only insofar as the category has a "schema" connecting it with time. The schema of substance is permanence, i.e., persistence through time. Correspondingly, accidents are the transitory. So to bring appearances under the concept of substance, we think them as consisting of persisting beings which transitory states. That we are justified in so thinking them, and indeed must think appearances this way, is argued in the First Analogy. For a discussion of this argument, see the lecture notes for February 8.