It does sound like anxiety. It won't solve the problem long term, but has your dog been crate trained? If you can't trust them around visitors, they should be crated till the visitors leave. I honestly don't know now how I ever got by before I got crates for my dogs! Mine don't threaten or act like they will bite visitors, they're just annoying as all get out - jumping on people, demanding attention, getting right in their faces and slurping them unmercifully. And if they get too over-the-top, it's in to the crate they go!
They come to see their crates as their own little sanctuary, their private protected little safe place, a place to stash their favorite "stuff". Mine are so respectful of the crates that neither one would even dream of going in the others' crate - it's their private territory, a place of their own. Your dog is probably feeling very anxious and nervous when visitors come. He would feel much more protected and safe in the confines of a crate than running loose in the midst of people he doesn't know.