You didn't say how old he is or if he has been neutered. If he is less than 3 years old, he may be challenging you for leadership. The key to most behavior problems is approaching things using the dog's natural instincts. Dogs see all the people and dogs in the household as a pack with each having their own rank in the pack and a top dog. Life is much easier if the 2 legged pack members outrank the 4 legged ones. You can learn to play the role of top dog by reading some books or going to a good obedience class. A good obedience class or book is about you being top dog, not about rewarding standard commands with a treat. Start at
Raising Your Dog with the Monks of New Skete For more on being top dog, see
Establishing and Keeping Alpha Position, Letting your dog know you are the boss
Such cases are much more common in unneutered males and much harder to solve if you don't do it.
When you are around you need to keep a close eye on the dog. Use closed doors or gates to keep it in the same room as you are, and perhaps as I do, a short chain fastened to the computer desk. If you catch it in the act, give it a sharp ''Ah, ah, ah!'' and take it out. When you can't watch it, crate it.
A dog that has not been crated since it was little, may take some work.
Start out just putting its toys and treats in the crate. Praise it for going
in. Feed it in the crate. This is also an easy way to maintain order at
feeding time for more than one dog.
The "shut the puppy in a safe room" is a fallacy. Very few houses even have a
safe room. How many of us have a room with a hard surfaced floor and nothing
else? Most rooms have electrical cords to chew if nothing else. In addition
to destroying anything a bored puppy finds to chew, it may choke or have
intestinal blockage from the pieces. I had a friend that left her dog in a
"safe" room. It ate a hole in the floor covering. The safe rooms fail to
give the dog the comfort of the enclosed space their instinct requires. Nor
do they restrict activity extending the time the dog can go without relieving
itself.