Have you checked it in the stand to see if the motor in the derailleur is actually moving back to the 21 spot? If it is, then you have some kind of programming error, which you will have to solve by contacting your LBS Di2 expert or Shimano. Otherwise, it may be a problem that is normal for all derailleurs (electronic or not.) It could be that your LOW limit screw is slightly too tight, and therefore the derailleur stays in between the 2 cogs and therefore and your chain moves down when you encounter a bump or something that makes it move a little bit.
This problem is especially relevant with Di2 because the motor actually shifts slightly past the point it is programmed as the center of the cog. There are 30 clicks in a Di2 brain, every shift it should move 3 for a 10 speed cassette. However, it moves 4 clicks to ensure that the chain moves to the next cog, and then shifts back one, to keep it centered on the cog.
Therefore, your limit screws may be out of adjustment, or you "electronic cable tension" may be off (this means that you need to calibrate where the "center of the cogs" is in the Di2 brain.) I would recommend checking your limit screw first, because it is a much easier adjustment, and involves no monkeying with electronics.
I hope that was clear
" onclick="window.open(this.href);return false;