It’s the belief that the gods/spirits were derived from the glorification and exaggeration of the actions of a real life hero or king.
I'm sure that happened on some occasions.... one of them seems to be "jesus." Nonetheless, I'm sure far more were simply invented by corrupt priests looking to assert their position over the commons. There is no rule which says that it must be one thing or the other.
But then, I tend to by cynical about such stuff!