A warranty is a guarantee of the integrity of a product and of the maker’s responsibility for it. In a sense, guarantee is the more general term and warranty is the more specific (that is, written and legal) term. But a closer look at these words shows a relationship that is even closer than that: they were originally one and the same.
The root of both words is the Old French word garantie, which comes from the verb garantir, meaning “to protect,” “to warrant,” or “to guarantee.” Unlike most words in French, which descend directly from Latin, this word has roots in the Germanic language spoken by the Franks called Old Low Franconian (an ancestor of modern Dutch). In French this language is called Francique (pronounced \frahn-seek\)—the language of the Franks. The Old Low Franconian word was warjan, meaning “to guarantee as true.” Germanic words from this period that began with an initial w- sound evolved to begin with gw-, and subsequently lost the w in some areas, leaving only initial g-. In the northernmost dialects of Old French this change never happened, and the w- was simply retained. Therefore, by the time these words crossed the English Channel some 200 to 300 years later, there were two separate words: warranty and guarantee.
The reason that warranty is spelled with two r's is that it was later influenced by warrant, which developed separately from the same root word. Both warrant and warranty have legal uses today, but we associate the former with judges and the latter with tiny-print documents that come with new purchases.