A spelling test, Spelling competition, but a spelling bee?
A ‘Bee,’ seems to come to us from "as busy as a bee.’ From that we get a communal activity. A quilting bee for example.
From Merriam-Webster:
That still doesn’t answer why it is a “spelling bee” however. A spelling bee is a contest rather than a communal activity. By that definition, kids would need to sit around helping each other spell big words.
“helping each other” is not part of the definition in Merriam-Webster.