Per the online etymology dictionary the word comes to English via Old French agreer which was derived from a gré literally to one's liking.

This did come from ad gratum but not without a lengthy trip through France.

The double-g wasn't present in the phrase a gré hence not brought over.


Actually, it is all a bit more complicated. In Middle English we find agry, agree, but also aggre, aggree etc. In Middle French too we have agrer, agreer, but also aggreer etc. So the decision to spell it with just one g in Modern English and Modern French is rather arbitrary. Mediaeval Latin aggreare is a back-formation from French.