Low-dimensional electron systems often show a delicate interplay between electron-phonon and electron-electron interactions, giving rise to interesting quantum phases such as the charge density wave (CDW) and magnetism. Using the density-functional theory (DFT) calculations with the semilocal and hybrid exchange-correlation functionals as well as the exact-exchange plus correlation in the random-phase approximation (EX + cRPA), we systematically investigate the ground state of the metallic atom wires containing dangling-bond (DB) electrons, fabricated by partially hydrogenating the GaN(10${\overline{1}}$0) and ZnO(10${\overline{1}}$0) surfaces. We find that the CDW or antiferromagnetic (AFM) order has an electronic energy gain due to a band-gap opening, thereby being more stabilized compared to the metallic state. Our semilocal DFT calculation predicts that both DB wires in GaN(10${\overline{1}}$0) and ZnO(10${\overline{1}}$0) have the same CDW ground state, whereas the hybrid DFT and EX+cRPA calculations predict the AFM ground state for the former DB wire and the CDW ground state for the latter one. It is revealed that more localized Ga DB electrons in GaN(10${\overline{1}}$0) prefer the AFM order, while less localized Zn DB electrons in ZnO(10${\overline{1}}$0) the CDW formation. Our findings demonstrate that the drastically different ground states are competing in the DB wires created on the two representative compound semiconductor surfaces.