What is the logic behind this progression?

This progression is not diatonic to any one key, nor is it an obvious transition from one key to another, so given the limited amount of information you've given, there are multiple interpretations with respect to diatonic harmony - so much so that I don't really see the point in trying to squeeze it into the framework of diatonic harmony in the first place.

If you really made me, I would consider it to be initially in the key of Cmaj (or F Lydian mode of Cmaj). The Gmaj7 would be treated as a normal V chord in Cmaj, but with a maj7 instead of a min7. The Gm7 and Fm7 would be treated as borrowed chords from the parallel key of Cmin. The C7 and Bb7 would be considered secondary dominants to the chords which follow them, and I would consider the Bb7 -> Ebmaj7 as a transition to the key of Ebmaj7.

However, my honest opinion is that this is a non-diatonic chord progression, and should be treated as such. Meaning, if you asked me to play over it, I would treat it as a modern, angular jazz progression where each chord would have to be played over on its own merit. I would follow the chords, rather than trying to shoehorn it into a particular key.

/r/musictheory Thread