wall anchor didn't go all the way in - hit a white plastic?
Is your wall made of cake? That first picture looks like cake. 

But seriously, look at the plastic anchor your tried to put in that hole and compare it to another one. I think you will find that the used one is broken. What happened is you screwed that anchor in to a stud, and it broke, leaving plastic behind.

Drywall anchors are used to hang things on drywall without studs behind them. If you need to hang something on a wall where there is a stud, just use a screw in to the stud. The screws that come with the anchors will probably work just fine. Or try installing another anchor an inch to the left or right, if the positioning is not that critical.

To prevent this in the future, you just need a little experience to feel the difference between hitting a stud and not hitting a stud with that type of anchor. Alternatively, use a stud finder to locate the studs first.

Or if you pre-drilled the hole, you just need a bit of experience to feel the difference between drilling in to a stud vs. just the drywall. Also, wood chips coming out of the hole while drilling is a clear sign that you hit a stud.

An appropriate screw for a light object such as your mirror would be a wood screw that penetrates the stud by at least 3/4 of an inch, plus 3/8 or 1/2 an inch for the drywall, plus whatever mounting length you need. 1 1/2 inch wood screws are probably suitable for your project. Depending on the size of the anchor you have, the screws that came with it are probably that length already.