You've just learned that most verbs form the Perfekt with haben. But a smaller group of verbs — used constantly in everyday speech — takes sein instead. The choice of helper verb doesn't change the meaning of the sentence, but it isn't optional: pick the wrong one and the sentence becomes ungrammatical even though everyone will still understand what you mean.
When exactly do you use sein? There are three groups worth memorizing well. The first is verbs of directed motion — verbs describing an actual movement from one point to another: gehen (go on foot), fahren (travel by vehicle), fliegen (fly), kommen (come), laufen, schwimmen. The key is that the verb must express a destination or direction, not just movement within one spot; that's why a verb like tanzen (to dance) normally takes haben, since dancing doesn't move you from place to place. The second group is verbs of change of state — verbs describing the subject shifting from one condition to a completely different one: aufstehen (from sleep to being awake), einschlafen (from awake to asleep), werden (to become), sterben (to die). The third group is a handful of exceptions that simply have to be memorized, since they don't logically fit either rule above: sein itself (Partizip II: gewesen), bleiben (to stay), and passieren (to happen).
A practical test: before using any verb, ask yourself "does this change the subject's location or condition?" If yes, use sein; if not, use haben as usual.
Many learners come from a language where the past tense doesn't distinguish between verb types at all — one past-tense form covers everything, with no split by helper verb. Because of that, the haben/sein distinction is often one of the trickiest points to internalize, since nothing in the learner's native grammar prepares them for it; it really has to be drilled and memorized as its own system.
The most common mistake is using haben with verbs of motion because the learner treats them like any other ordinary verb, producing the wrong Ich habe nach Berlin gefahren instead of the correct Ich bin nach Berlin gefahren. Remember: any verb of motion that changes location requires sein, without exception.