Energy of flyback with multiple outputs
where does the additional energy for flyback with multiple
outputs come from?

The primary voltage is &quot;held across&quot; the primary inductance for as long as it takes to acquire sufficient energy to match the energy requirement of the secondary load(s). This is where the control of duty cycle comes in. A higher power requirement in the load(s) means that the energy transferred in each switching cycle must increase and that means increasing duty cycle in DCM or raising the average primary current in CCM.
$$\text{Total load power  = energy transferred each cycle}\times \text{switching frequency}$$
In DCM (see picture below) you only get more energy per cycle by increasing the duty cycle.
Primary and secondary current waveforms in DCM. Transformer ratio is 1:1: -

Equivalent circuit: -

As load power increases, the duty cycle increases giving more time for the primary to &quot;charge&quot; with energy. The &quot;hold&quot; time will shorten as the secondary power requirement grows. But remember, the basic flyback circuit cannot do this on its own; it needs a controller that monitors one of the output voltages (the &quot;chosen one&quot;) and adjusts duty cycle to keep that voltage regulated.
The other windings on the secondary side are a little bit outside the control loop and may grow their voltages a few percent as the controller increases the duty cycle to maintain the &quot;chosen&quot; secondary voltage regulated.
Pictures from here and here.

therefore power in primary is constant

No, it's dependent on duty cycle i.e. how long you apply Vin to the primary winding for.

Edited to add CCM waveforms: -

In CCM, if the load current becomes too high, the output voltage will tend to droop (and di/dt will flatten). The knock-on effect of this is that there will be more magnetic field in the core when the charging period restarts and, at the end of the charging period, the peak primary current will naturally be a little higher. Thus, duty cycle remains the same but, the average primary current has increased to deliver the increased secondary energy.