How to stop this small roof from leaking?
I believe that you are getting leaks through that gap. Wind driven ran can push water right under that flashing.

You can install sealant underneath the flashing like Aravindakshan K suggested. I would take it a step further, and add roofing nails with the neoprene washers on them to hold the flashing closer to the roof.

I have the same problem with my front porch. It doesn't have proper footings and has sunk over time causing a separation in the flashing. Your roof appears to have the same situation. It is likely that that separation will continue unless you address the structural issue.