When attempting to install Windows 10 or Ubuntu 22.04 on legacy systems, you need to have something more than just the ISO image on the pen drive that you use as a boot medium.
For creating a bootable Windows 10 medium
If your plan is to create the bootable pen drive in Ubuntu, don't do it. Instead, go to a Windows system and download Rufus. Run Rufus, select your pen drive and ISO file from the options in Rufus and select MBR instead of GPT. The GPT option is for modern systems which have UEFI.
Also, select the checkbox for installing additional 'things' for legacy system support.
Now your install will work without problems.
For creating a bootable Ubuntu 22.04 medium
When I used Ubuntu's startup disk creator and tried booting from the pen drive, the screen just showed a blinking cursor on the top left of the screen and the installation didn't proceed. The same thing happened when I used Rufus to write the Ubuntu ISO to the pen drive, without selecting the checkbox for installing the additional 'things'.
However, when I used Rufus with the checkbox, everything worked fine.
On second thought, don't bother installing Ubuntu 22.04. There are still some errors that they haven't fixed, and some third party programs do not seem to have developed API's to be fully compatible with it. As Jesse Smith wrote: "I think the launch of Ubuntu 22.04 is a clear sign Canonical is much more interested in publishing releases on a set schedule than producing something worthwhile. This version was not ready for release and it is probably going to be a costly endeavour to maintain this collection of mixed versioned software and mixed display server and mixed designs for a full five years. It's a platform I would recommend avoiding".