Casual mediation analysis (CMA) plays an essential role in various fields of social sciences. However, traditional models have restrictive parametric settings and strong random assumptions, which can be inflexible due to general nonlinearity, heterogeneity, and complex noise effects in many applications. Motivated by the similarities between the CMA and image-to-image translation that were thought to be unrelated initially, this paper proposes a novel prototype called the Generative Adversarial Mediation Network (GAMN), to explore the generative learning approach in the context of CMA. Thanks to a new encoding scheme for random terms, carefully designed partially linear architecture and inherent advantages of the generative learning framework, GAMN can flexibly handle nonlinear covariate effects and effectively model complex noise and heterogeneous mediating mechanisms with minimal model assumptions. Thus, when encountering intricate data patterns, the counterfactuals relating to treatment effects in CMA can be efficiently inferred, providing more promising mediation results. Experiments conducted on both synthetic and realistic datasets demonstrate that, compared with state-of-the-arts, GAMN can achieve notably more accurate estimations of out-of-sample predictions and treatment/mediation effects, which further illustrate the utility and advantages of our method. With the novel reinterpretations and solid theoretical results, this study also substantially broadens insights into developing mediation models from a machine-learning perspective.