Behavior vs. behaviour is one of plenty words that are spelled differently in American English than in UK English. It’s part of a pattern that reaches across the majority of words with the same ending, like flavor/flavour color/colour, labor/labour, and so on. Which spelling is “accurate” depends on where your desired audience is located.
The French influence
Every English school-aged child learns the exact date of the Battle of Hastings when William the Conqueror conquered England and started the Norman dynasty. The Normans had an extensive history in France, and from William’s time, French was the language of the English court. Different linguists have estimated that between one and two-thirds of English words originally came from French. Many of them can still be simply recognized by their endings; try to pronounce words ending in
-ment, -age, -tion, or even -ain in a “French-sounding” manner, and you will have a better idea of how this came about. Common French phrases such as bonjour (good day) or au secour! (help!) illustrate the ending -our in such English words as honour, behaviour, and humour.
Setting American and British standards
This is being written in a grammar program set to American English, so it has tried autocorrecting those three words a couple of times. So why does American spelling differ? For a lot of the history of reading and writing, there weren’t any set rules for spelling, and different scribes wrote the words how they heard them. One scribe might hear “neighbor,” another might hear “neighbour.” Efforts began in the eighteenth and nineteenth centuries to standardize spellings. Working in England, Samuel Johnson published his dictionary in 1755, setting forth the “British Standard,” and commonly favored the Old French endings, in honor of the words’ French origins.
The “American Standard” came from Noah Webster, who published his dictionary in 1828 while using the -or ending, which Webster found more phonetically correct than -our. Webster’s Blue-Backed Speller was widely used in elementary schools, which resulted in whole generations of Americans learning to read using Webster’s standards of spelling. Even nowadays, American spelling stems from Webster’s Dictionary, and the updated version, called Merriam-Webster, is still upheld as the standard.
Choose your audience
The English-speaking world today is split between the United States of America, on one hand, and Great Britain and former colonies, on the other hand. Non-English-speaking countries may frequently use one spelling standard or the other, depending on whether or not they feel strongly influenced by the United States or the former British Empire. Choosing behavior vs. behaviour depends on where, and to whom one is writing. Is your targeted audience American? Use favor. British or a former colony? Use favour.
Related: Here is another article about British vs. American spelling