Review the original item:
Mike has terrible eating habits when he opened
his lunch bag, we saw a bag of potato chips, two candy bars, cellophane-wrapped
cupcakes, and a carton of chocolate milk.
You wanted to fix it this way:
Mike has terrible eating habits,
but when he opened his lunch bag, we saw a bag of potato chips, two
candy bars, cellophane-wrapped cupcakes, and a carton of chocolate milk.
A perfectly good method of fixing a fused sentence is to separate the two complete sentences with a comma and a coordinating conjunction like but.
When you use this method, however, the revision must make sense. But is a contrast word, and the two sections of the fused sentence above are not showing contrast.
You might want to consult the rules for fixing comma splices and fused sentences.