It's got to be the larvae of some kind of moth or possibly another bug.
they come in all shapes & sizes.
The cocoon can be mobile & can be made of whatever, depending on the creature.
Looks like it's feeding on the paint on your wall.
Keep an eye on it till it goes thru metamorphosis, then you will know what it is.