Spintronics is a particularly hot topic in recent years, which has aroused much attention. The spin freedomof electrons can be used to construct logic devices and memory devices. Generally, the most importantspintronic properties are found in half-metal ferromagnets, which are considered as the ideal materials forbuilding spintronic devices due to their ability to provide fully spin-polarised conduction electrons. Numerousexperimental data and theoretical studies have confirmed that the intercalation, doping and adsorption oftransition metal atoms can induce magnetic properties in two-dimensional WS2 material. Therefore, half-metalferromagnets formed by doping WS2 play an important role in the field of spintronics. In this paper, weinvestigate the electronic structure, magnetic and optical properties of the WS2 doped with transition metalatoms X (X = Mn, Tc, Re) by the first-principles plane wave method based on density functional theory. Theresults show that the WS2 system doped with transition metal atoms X is more stable under S-rich conditionthan under W-rich condition. Especially, the WS2 system doped with Tc has a minimum value of formationenergy of -1.292 eV under S-rich condition. After doping with Mn, impurity levels appear in the spin-upchannels, resulting in the WS2 system changing from a non-magnetic semiconductor to half-metal ferromagnetwith a magnetic moment of 1.001 . Moreover, in the Mn-doped system, the densities of states are asymmetricin the spin-up channel and the spin-down channel. After being doped with Tc and Re, the systems aretransformed into non-magnetic N-type semiconductors, and the densities of states in spin-up and spin-downchannels are symmetric in Tc doping system and Re doping system. Whereafter, the spin orbit splitting of theimpurity states near the Fermi level EF decreases successively from Mn to Re doped WS2 systems. Comparedwith the undoped two-dimensional WS2, the transition metal atoms X doped WS2 systems show that all dopedsystems not only have a significant red shift of optical absorption edges but also enhance peak value in infraredand visible light region, implying that the transition metal atoms X doped WS2 systems have great applicationprospects in infrared and visible light detection. We hope that thepresent study of two-dimensional WS2 willprovide useful theoretical guidance for future experiments to explore low-dimensional spintronic materials