I can't speak to what's happening in your VirtualBox installation (but I suspect it's something similar). The issue with WSL, at least, is that you don't appear to have an X application running in which to target the output of Xdotool. If you do, you don't mention it, at least.
It's an easy mistake to make -- I did it myself just a few days ago when trying something out.
Just running the X server doesn't give it a target application. You would need to be running the command above in an X terminal application, such as Xterm in order to see the results.
The terminal in which Ubuntu is running under WSL is not, of course, an X application; it's a Windows application.
Also note that you shouldn't even need Xming any more for this to work. All recent releases of WSL support GUI applications directly. See this answer for more information. It's doubtful that the KB patch is even needed any longer, as it should be integrated into the mainline monthly servicing releases at this point.
With that installed, remove any changes to the DISPLAY
variable that you put in place for Xming. The stock WSL should manage DISPLAY
correctly.
Then:
sudo apt install xterm
From WSL, run xterm
. And inside that Xterm terminal, run your:
xdotool type "hello"
You should see the Hello
entered at the next prompt-line in Xterm.
Note that, according to this answer many applications do not accept "sent" keystrokes unless they are already the foreground application. This is for security reasons.