During training the model learns how images get corrupted when noise is added, and how to reverse the process. At generation time it starts from pure noise, and the prompt guides every “denoising” step.
This technique powers Stable Diffusion, Midjourney, FLUX and most video models. Because the starting point is random, you get a different image each time even with the same prompt — unless you fix the “seed”.