The expression “in the doghouse” means: In a predicament; in a pickle; in a pretty how-de-do; in disgrace.
This American slang of the early twentieth century came into being through analogy.
Anyone who was considered, usually by a man’s wife, to be “going to the dogs” was, in theory at least, thought to be fit to associate only with the family dog, especially for slumber; hence, figuratively, consigned to the dog kennel.
The notion became enlarged.
In due course the husband began to realize that any time he was going to have domestic difficulty, especially in explaining an action, he would again be out of favor and again be relegated to the doghouse.