Layered transition metal dichalcogenides with unique mechanical, electronic, optical, and chemical properties can be used for novel nanoelectronic and optoelectronic devices. Large-area monolayers synthesized using chemical vapor deposition are often polycrystals with many dislocations and grain boundaries (GBs). In the present paper, atomic structure and electronic properties of MX2 (M = Mo, W, Nb; X = S, Se) with the GBs were investigated using first principles based on density functional theory. Simulation results revealed that the zigzag-oriented GBs (which consist of pentagon/heptagons (5-7) pairs) were more stable than the armchair-oriented GBs (which consist of pentagon/heptagons (5-7-5-7) pairs). The GBs induced defect levels are located within the band gap for the semiconductor materials of MX2 (M = Mo, W; X = S, Se) monolayers, and the NbS2 and NbSe2 remained as metallic materials with GBs. Results provided a possible pathway to build these nano-layered materials into nanoelectronic devices.