Not every composer—technically any composer can write to any lyric, and technically any lyric writer can write to any melody, but you've got to be able to do it well.
It was, according to the writer of the lyrics of the song, the words of the song, Johnny Mercer, inspired by a moon shining on a river near the place where Mercer grew up in Savannah, Georgia.