First of all, a warning: all these etymologies are to some extent hypothetical. Especially when it gets back to Proto-Germanic and Proto-Indo-European, there's no actual proof of how the language worked; it's all reconstructed by linguists. But these reconstructions are generally quite informative, even if we can never be 100% sure they're right. Reconstructed words are marked with a star.
Short version: the English and French words are related more closely than the English and German words, though they all go back to the same place.
Long version:
Proto-Indo-European
Back in Proto-Indo-European, the oldest reconstructible ancestor of English, there was a root *gʰ-rdʰ- meaning "enclose". One form of this word was *gʰ-ó-rdʰ-os "enclosure". This led to a great number of words across Eurasia, such as Russian górod "town", Latin hortus "garden", and Welsh garth "hill". But we're only interested in one specific descendant from this stage.
Proto-Germanic
In the branch of Proto-Indo-European from which English and German and Icelandic (and several other languages) descend, this eventually became *garđô, still meaning "enclosure".
Here, the line of descent splits!
Old High German
German wasn't affected much by Frankish or the Romance languages, compared to English and French. The Proto-Germanic *garđô led to Old High German garto, Middle High German garte, and finally Modern German Garten.
Old English
In Old English, *garđô became ġeard, which led to Middle English yeard, and thus Modern English yard. So yard is actually the "purest" English cognate to German Garten!
Old Frankish
One of the other languages descended from Proto-Germanic is called Frankish. It's now died out, but it was spoken in what is now France. In this language, *garđô became *gardō.
Vulgar Latin
The Vulgar Latin spoken at the time borrowed the Frankish word as an adjective gardinus "pertaining to gardens". This definitely came from *gardō, but the -in- might be a Vulgar Latin diminutive or adjective-forming suffix, or might be from a different form of the Frankish word: without more information on Frankish we can't really be sure.
And the line of descent splits again.
Old French
In Old French the Vulgar Latin word evolved into jardin "garden" quite regularly. This stayed the same all the way to Modern French.
Anglo-Norman
Another branch of what we now call French ended up coming to England with the Norman conquest. In this branch, the word stayed gardin, without the first consonant changing. This became Modern English garden.