How to wire a 4 prong outlet in my generator to 3 prong dryer?
I hate to break it to you...
But this really needs to be done better than what you plan.
Let's tackle the big ones first.
There MUST be an interlock to protect linemen
Electricity is distributed at high voltage (50,000V) which is knocked down to medium (10,000V) at a transformer, then down to 120/240V at another transformer.
It's absolutely possible for a generator to push electricity back out onto the grid.  When it reaches a transformer it'll just go through in reverse, so your generator will cause a 10,000V section to light up at 10,000 volts.  And that will &quot;light up&quot; the linemen who's out there at 4am away from family working to get your power back on.
Some consider that impolite.
A lot of homeowners get this genius idea that they'll just have a procedure: &quot;Turn THIS off, then plug in THIS, then start the gen, then turn on THAT&quot;.  They've got it all worked out.  But when The Stuff Hits The Fan and the pressure's on in the rainy dark to get the lights on, fog of war, it ain't working, trying anything, or you're away and the wife asks the neighbor to help.  The long experience of accident investigators is that procedure lists Just Don't Work.
As such, a line-generator interlock is mandatory.
For a lot of panels, this is actually pretty easy - I had somebody who had run out of circuits on a klutzy $550 10-switch Reliance transfer switch, and the panel was a Siemens.  I instantly realized the Reliance was unnecessary, the whole panel could be switched with an ECSBPK01 interlock (go price that lol) or possibly an ECSBPK02 if &gt;125A was needed. Even with the needed breakers it'd have been under $100.
Get us some pics of your panel, and we can see if there's an equally easy answer for yours.
No Suicide Cords.  Ever.  Use an inlet.
You don't want to ever have a cord that has males (pointy ones) on both ends.  It is a matter of time before tragedy happens.  Things which  take power have pointy ends, so &quot;your house&quot; should have the pointy ends.  You should not be using a normal socket and a suicide cord, you should be using a &quot;reverse socket&quot; called an inlet, and a normal cord.
When the inlet is combined with the interlock, it is impossible for the prongs to ever be energized.  This makes it safe.
There are 2 ways to get an inlet.  First, they sell actual inlets, that mount where you please and look a lot like a socket but have prongs instead of holes.  They can be a bit pricey.
So instead you can just use literally a cord and plug. You have to terminate the flexible cord in a junction box with a strain relief.  And you need to put some thought into avoiding physical damage when the cord's not in use.  But it's just that easy to Git-r-Dun.
Yeah, it's legal for flexible cordage to be part of a building's wiring, if it's something that is frequently connected, disconnected or moved.  NEC 400.6-8 somewhere in there.
Permanent wiring, done temporarily
Very often I need a circuit to operate for a few hours. I just use proper permanent wiring methods so it's OK to run forever.  Then, when the crisis is over, I undo all the wiring and change it back.
This has the elegance of making the &quot;interlock&quot; question moot, since you are de-wiring the circuits from the grid.
Knock a knockout out of the side of my panel, run a cord from the generator into it, put a cable clamp on it. Legal.  When the power fails, turn the main off, take the cover off the panel, identify the circuits I want to power, pull their hots and neutrals off the breakers and bars, and nut them to the generator hot and neutral. Close up the panel. Now those circuits are permanently rewired to run of generator only.
Or, if there was a disconnect to de-energize the main feed coming into the panel, I'd do that.  Then yank the main feed hot wires off and cap 'em off.  I'd attach the generator supply wires there, and button the panel back up.  Now the whole panel is permanently rewired to run off generator only.  Of course as soon as the power returns, I'd reverse it.
All the stuff I'm saying is Code legal, except the first one if you are connecting 15A or 20A branch circuits to a 30A generator breaker, that's over-fusing obviously. But it may come down to choosing your code violation wisely.
Romex/NM cable as cordage
You're familiar with cordage; it's appliance cords.  It's stranded and very flexible and durable.  You're supposed to use that for temporary or flexible cables e.g. to appliances or between generators and inlets.   It's also more expensive.
Romex/NM/UF cable should not be used for that, because it is solid wire - it's not flexible, and repeated flexing will fatigue and break it.  It's also not made to be underfoot, pulled on, or any of the daily indignities that cordage suffers daily.
Use the Romex to run in the walls to the panel, or an isolated run between an outlet and inlet/cord/plug.   For instance once you upgrade your dryer socket, you could use the #10 Romex to continue as permanent wiring to a convenient location for a welder receptacle.  Turns out you can have 2+ 30A receps on the same circuit.
But speaking of that...
That old NEMA 10 dryer recep is dangerous as heck
We see loose neutral wires on here all the time.
Now, it's common for people to 'bootleg ground' where (at an outlet) they connect ground to neutral so the tester reads good.   The problem with a bootlegged ground is, if you get a loose neutral wire, the neutral floats at 120V and so does the ground/chassis of the machine.
Now, the obsolete NEMA 10 uses hot-hot-neutral.  No ground. But when grounding came along, the appliance manufacturers asked to be allowed to simply attach the appliance chassis to neutral.  Well, that's bootlegging ground!  And yeah, it has the same problem, and from time to time, this kills somebody.
However this is easy to fix.  #1 change the dryer cord to 4-prong NEMA 14-30, and remove the internal bootleg jumper from the dryer.   #2 run a plain old #10 ground wire from the dryer socket junction box back to the panel or any other #10 ground wire going back to the panel... water heater, grounding electrode, metal conduit, whatevs.  #3 change the socket to NEMA 14-30.
Once it's changed to 14-30, it's legal to use with both dryers (hot-hot-neutral) and welders (hot-hot-ground).  Since it has both.