If you don’t like worms, one is bad enough. But a whole can of worms is really bad! A can of worms is a very difficult issue or set of problems. And to open a can of worms means to share those problems with other people who may not want to know about them.
Now, worms are good at slowly digging themselves into the ground. And when they are in the ground they are difficult to catch. This is the root of two common expressions.
If you worm your way into something, you get something you want by slowly using tricks and lies. For example, “I can’t believe he wormed his way back into her life! She won’t ever learn!” And if you worm your way out of something, you are avoiding or escaping something by using again tricks or lies.