I had miscarriage and d&c 3 weeks ago. Now I am spotting yellow and a bit red in morning. What is the problem?

Spotting after D&C. By 3 weeks after a d&c, the tissues have usually healed up and spotting has resolved. In cases where spotting is persistent you have to consider whether there may be a low-grade infection in the uterus (it would be at least mildly tender, and would need antibiotics) or some retained clots that are slowly dissolving. Check with your doctor. He will do an exam and consider an ultrasound if not sure.