How can my cat have worms???
If you have ever stepped in another animals poop outside and then walked inside and the cat had contact with your shoes the cat could get worms from that. Most likely if the cat doesn’t go outside the worms came from somewhere that you have been and stepped in worms or some worm eggs. Don’t stress about it too much just bring the cat to the vet and get some de-wormer treatments and they will take care of it. Maybe it would be a good idea to keep your shoes away from where the cat can get to them, maybe in a closet or something.