This used to be fine without the flexible adapter, I had a rigid gutter to pipe adapter in the past. The ground below must have pushed the pipe around over time. The fitting was barely working for the last year and more recently not working at all. I bought a flexible adapter today and it is really straining to fit. Is there a better solution? I could not find flexible pipe to pipe connectors for this job.
I would suggest that you replace the rigid gutter to pipe adapter with a new one. Adjust the downspout as necessary to make it fit.
What you've got now looks like it will restrict water flow because the flex pipe has a dip in it - effectively a shallow P-trap. Not something you want in an rain gutter. Also, if that's not a tight fit between the flex and rigid piping, you're going to end up with dirt and plant life in the buried section and it will end up backing up and flooding this area.
I can't tell from the picture which way the rigid pipe goes once it's underground, but you may have to dig up a few inches of it to move it so it will once again meet up with the downspout and adapter.
dig some of that dirt out of the way, push the black flexible pipe down and back against the foundation, rotate the black elbow until it faces upward an use a rigid adaptor to connect the two pipes. (or instead remove the black elbow and just use the flexible adaptor to connect ro the black pipe.)
an empty pipe is lighter than dirt and will tend to float out of mud, so you may need put a stake into the groud to fix its location.