Hold down W, then quickly press D twice. The bug is that if an action similar to the procedure above is performed, then the player will begin sprinting even though W was not tapped twice or the command key held down. This bug also occurs if the A key or the S key is tried instead of the D key.
Linked issues
Comments 1

Thank you for your report!
We're actually already tracking this issue at MCPE-21635, so I will resolve and link this ticket as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – ✍️ Feedback and Suggestions – 📖 Game Wiki