This is the first boss of the Flying Battery Zone. Dr. Eggman traps Sonic into a big trash compactor.
With a robotic device also trying to blast the blue hedgehog away for good. As the battle progresses, it reminds me of the scene in Star Wars Episode IV: A New Hope where the walls keep compressing.
Though the boss fight is fairly easy, I didn’t have much trouble myself.