In ancient Judaism, uttering the name of Yahweh was thought to bring him into your presence. If you did call him forth, you'd better have a damned good reason! After all, he's a busy deity, what with all the smiting and all. Therefore, they introduced the restriction on "using the name of God in vain."
There were plenty of other gods, of course. The ancients recognized this, but considered Yahweh their own tribal deity. They found him on a mountain top and cut a deal with him. "You get me off this freakin' mountain, and I'll protect you from your enemies." The word "God" was capitalized to distinguish theirs from others.