This is due to Old English Palatalization, the same reason modern English has "hard" and "soft" versions of the letters g and c.
Wikipedia has more details, but to summarize: in certain environments, the velar consonants
/g/ changed their pronunciation.
/g/ (the first sound in "get") usually ended up turning into
/j/ (the first sound in "yes") or
/d͡ʒ/ (the first sound in "gem"), depending on what came before it.
In this particular case, the Old English word was
/dæg/, with a
/g/ after a front vowel
/æ/. And in this environment,
/j/, eventually spelled with the letter y, giving day. In the ancestor of modern German, these changes didn't happen, so the
/g/ stuck around, giving Tag.
(By the way, the different initial consonants in day~Tag aren't due to Grimm's Law—Grimm's Law happened back before the ancestor of German and the ancestor of English split apart. Instead, this is due to the second Germanic consonant shift, also known as the High German consonant shift, which affected the ancestor of modern German but not the ancestor of modern English.)