The ‘case’ of a personal pronoun depends on the function the pronoun serves in the sentence.
Based on function, a pronoun can serve as a subject, a complement (predicate nominative, direct object, or indirect object), an object of a preposition, or a replacement for a possessive noun.
When the Pronoun is the Subject
(I is the subject of the sentence. Therefore, use the nominative (subjective) case form of the pronoun.)