Behavior/Behaviour is one of many words that are spelled differently in American English and UK English. It is part of a pattern that extends across the majority of words with the same ending, such as color/colour, harbor/harbour, and so on. Which spelling is “correct” depends on where the intended audience is located.
Every English schoolchild learns the exact date of the Battle of Hastings, when William the Conqueror conquered England and began the Norman dynasty. The Normans had a long history in France, and from William’s time, French was the language of the English court. Different linguists have estimated that between one-third and two-thirds of English words came originally from French. Many of them can still be easily recognized by their endings; try pronouncing words ending in -age, -ment, -tion, or even -ain in a “French-sounding” way, and you will have a good idea of how this came about. Such common French phrases as bonjour (good day) or au secour! (help!) illustrate the -our ending in such English words as behaviour, colour, and harbour.
I am writing this on a word processor set to American English, so it marked those three words as misspelled. Why does American spelling differ? For much of the history of reading and writing, there were no set rules of spelling, and different scribes wrote the words as they heard them. One scribe might hear “harbor,” another might hear “harbour.” In the eighteenth and nineteenth centuries, efforts began to standardize spellings. Samuel Johnson, working in England, published his dictionary in 1755, setting forth the “British Standard,” and generally favored the Old French endings, in honor of the French origins of the words.
The “American Standard” came from Noah Webster, who published his dictionary in 1828, and used the -or ending, which Webster found more phonetic than -our. Webster’s Blue-Backed Speller was widely adopted in elementary schools, with the result that whole generations of Americans learned to read using Webster’s standards of spelling. Even today, American spelling is based on Webster’s Dictionary, and the updated version, called Merriam-Webster, is still held to be the standard.
The English-speaking world today is divided between the United States of America, on one hand, and Great Britain and her former colonies, on the other hand. Non-English-speaking countries may commonly use one spelling standard or the other, depending on whether they feel more strongly influenced by the United States or the former British Empire. The decision whether to write behavior or behaviour depends on where, and to whom one is writing. Is your intended audience American? Use behavior. British or a former colony? Use behaviour.