Your intuition about the Gm is absolutely correct: it's just a result of mode mixture, also called modal interchange.
Before this Gm9, we have FM7–G7–Am7, which is really a IV7–V7–vi7 progression in C major. The Gm9 is then just a chord borrowed from C Mixolydian; instead of a V9 chord, we now have a v9 chord. I think borrowing from Mixolydian is better than borrowing from the parallel minor of C minor. If we were borrowing from C minor, we'd likely have an A♭ as well, which we don't.
At this point, the Gm9 moving to Dm is simply a v–ii progression in C. (You could also think of these as being brief i–v motions in Gm, but I don't hear G as tonic here). There's no chromaticism or fancy chord motion, it's just a minor dominant moving to the supertonic (ii) chord.