Usually, mold does not grow on a sourdough starter because the naturally developing yeasts compete with other bacteria and fungi and prevent them from growing.
Most likely, your sourdough starter is contaminated by food or soap residue, usually because your utensils or the container was not completely clean, your hands were not clean, or a fly got into the container.
You have neglected your sourdough starter by not feeding it enough or not feeding it correctly., which means that the yeast is weakened and cannot overcome the mold ‘intruders’.