According to Webster, agree comes from Latin ad + gratus. However there are other words such as aggregate and aggression that also come from ad + [something], and these words are spelled with a double “g” while agree only has a single “g”. Why does agree have only one “g”?
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.