Okay, imagine you have a basket full of apples. All the apples in the basket are good, except for one. That one bad apple has started becoming brown, mushy and smelly. It spoils the taste and texture of the other apples in the basket if it is not removed.
Similarly, in real life, when we say someone is a "bad apple," it means they are behaving badly or doing wrong things. They are being a negative influence on those around them. Like our bad apple in the basket, if we don't remove their bad behavior, it can affect the behavior of others around them too.
So, we should always try to behave well, but if someone in our group is not behaving properly, we should talk to them and try to help them become a good apple again. If we can't help them, then we might have to be brave and separate ourselves from them, so that their bad behavior doesn't hurt us or others.