Mold is not good and is often caused by using old flour. Your flour should be fresh to make a starter. The bacteria need the nutrients. You wouldn't feed a baby old milk. Or it could be that something that shouldn't have got introduced to the jar got in there at some point. Maybe a bit of dirt on a spatula or in the jar. It can also become moldy if it's left for ages and ages in the fridge without being used. Depending on how moldy it is, you can try retrieving some fresh starter from under the surface of the mould, transferring it to a clean jar and feeding it up until healthy and thriving again. There is a chance that the mould will appear again though. If that happens there's only one place for your starter to go. That's in the compost bin. R.I.P. I guess you'll be starting all over again. Take note of the tips about having a sourdough starter insurance policy a few paragraphs below.