How do resistors generate different heat if we make the current fixed and changed the voltage and resistance? Notice the flow of charge is constant

Your initial circuit is like this:

enter image description here

So you get 2A flowing and a power of 20W dissipated in the resistor.

Then you double the voltage and the resistance:

enter image description here

The two batteries add up to single source of 20V. The two resistors add up to a total resistance of 10$\Omega$. So, as you correctly state, the current is the same as before (2A). Therefore the power is now 40W

But this power is shared between the two resistors: 20W each, exactly as before.

You might also note that the potential at the point between the resistors is 10V, so each resistor has 10V across it, exactly as before.

Really all you've done is doubled up the circuit so that you have twice of what you had before.

  • Think of sucking liquid through a straw. It flows at a certain speed.
  • Now squeeze the straw (increase the resistance). The flow (volume per second) slows down.
  • In order to keep the flow-speed high, you must suck harder. That's the voltage (think of it as an electric "pressure"). This dent in the straw is now "using up" all of the pressure, which now is much higher.

Basically, the dent in the straw does cause energy loss and thus would have caused the flow to slow down. You just don't notice because you replenish the flow right away by having the pressure higher.

This is directly analogous to electric circuits: The larger resistance does cause energy loss and thus would have caused the current (electron flow) to slow down since it "sucks out" their kinetic energy. But you don't notice because you counteract this loss with a higher voltage that "forces" the electrons forward to keep the same speed nevertheless.

Think of the resistor as being like a pipe packed full of magically immoveable (so they won't get swept away by the flow) pebbles(*). The electric current is like water flowing through this pipe. Different resistors have different pebble densities, and the more tightly packed the pebbles are with fewer and more convoluted void spaces between them, the harder it is for the water to get through. The electric field in the wire pushes the water through the pebble bed, like a source of water pressure, such as a pump or downhill slope does with real water.

Now, suppose one pipe has a relatively coarse and gap-filled pebble fill (lower $R$), while the other has a finer and more densely-packed fill (higher $R$). Both are subjected to a flow of water, and those flows are tuned so that both maintain the same perfusion (rate of water making it through) of the pebble bed. Do you think equal driving force, and so pressure, will result in identical perfusion? If not, which do think will need more and which less?

And then, if you're driving it harder, that means a greater force is being exerted and more work is being done in any given time to get the same result (flow or rate of perfusion), hence the faster also the rate at which energy is being dissipated into heat. Which, then, has the largest dissipation and hence gets the hottest?

(*) NB to other readers: Technically, the "pebbles" in a real resistor are moveable and, in fact, flying around all over (for a suitably quantum-mechanically fuzzy notion of 'flying'), but I am using this to keep the illustration simple.