Heya,
I assume you used flash in the first one? If so, just note that when using lighting, you're doing two exposures in one. Ambient & subject are separate.
With a portrait, your lighting is exposing the subject, and your camera is exposing for ambient light. So in your first photo, if you want to not blow out a window or ambient light in general like you did there, then you adjust camera settings for ambient exposure. You will find you either need to stop down aperture significantly against a bright sunny window (which you may not want to do, if you're trying to keep a thin depth of field look), or you have to employ things like high speed sync flash so that your shutter brings down ambient light, or use an ND filter to drop all light while keeping aperture open. Keep your sync speed on your camera (unless using HSS), and just adjust aperture & ISO for ambient light. Again, you could apply a ND filter to further drop ambient light without closing down aperture. Your flash power level is now your exposure for your subject, raise that to whatever it takes. Camera to ambient light. Flash to subject light. Also when mixing flash & ambient, you have to note that they're different temperatures of light often (flash is cold). It's a good idea to get a 1/4, 1/2, etc, CTO gel for your flash.
In your first, photo, you used ISO 500. But why? By doing that, you raised ambient light by over 2 stops (leave it base ISO 100 if you want to drop ambient exposure), and that contributed to blowing out the window exposure. Let your lighting expose the subject. Camera settings expose ambient.
Very best,