Trichoderma sp. is extensively applied as a beneficial fungus for the management of plant diseases, plant growth promotion, induced resistance, and plays an important role in global sustainable agriculture. This study aimed to enhance the production of microbial xylanase in high titer from the endophytic fungus Trichoderma harzianum kj831197.1, and the cloning of xylanase genes in E. coli DH5α using a pUC19 vector. A combination of glucose, 0.1 mM, Tween 80 with lactose, and 2 mM galactose combined with malt extract boostedthe enzyme production. Xylanase production was maximized at a pH of 5.0, temp. of 30 °C, and agitation of 150 rpm in the presence of malt extract and bagasse as the best nitrogen source and waste, respectively, using submerged fermentation. The molecular weight of highly purified xylanase was 32 KDa, identified using SDS-PAGE. The xylanase gene of T. harzianum kj831197.1 was screened in fungal DNA using definite primers specified in the gene bank database. The identified region was excised using restriction enzymes HindIII and EcoRI and cloned into a pUC19 plasmid vector. Optimization of fermentation conditions improved xylanase production about 23.9-fold.The antifungal efficacy of xylanase toward different phytopathogenic fungi was determined. The highest inhibition was against Corynespora cassiicola, Alternaria sp., Fusarium oxysporum, and Botrytis fabae. This study offered an economical, simple, and efficient method using Trichoderma harzianum kj831197.1 for the production of the xylanase enzyme via the submerged fermentation method.