The fungus Talaromyces hainanensis, isolated from the mangrove soil, was characterized as a novel species by morphology observation and phylogenetic analyses. Four new γ-lactam alkaloids talaroilactams A-D (1-4) and two reported compounds harzianic acid (5) and isoharzianic acid (6) were identified from the fungus T. hainanensis WHUF0341, assisted by OSMAC along with molecular networking approaches. Their structures were determined through ECD calculations and spectroscopic analyses. Moreover, the biosynthetic route of 1-4 was also proposed. Compound 1 displayed potent cytotoxicity against HepG2 cell lines, with an IC50 value of 10.75 ± 1.11 μM. In addition, network pharmacology was employed to dissect the probable mechanisms contributing to the antihepatocellular carcinoma effects of compound 1, revealing that cytotoxicity was mainly associated with proteolysis, negative regulation of autophagy, inflammatory response, and the renin-angiotensin system. These results not only expanded the chemical space of natural products from the mangrove associated fungi but also afforded promising lead compounds for developing the antihepatocellular carcinoma agents.