Proton exchange membrane water electrolysis cell (PEMEC) offers a clean and promising way for hydrogen production. The spatial internal current density and temperature distribution uniformity significantly determines its reliability and durability, as well as the hydrogen production performance. Here, a non-isothermal 3D computational fluid dynamics (CFD) model for PEMEC with parallel flow fields is employed to investigate the impacts of the heterogeneous porosity distribution within the anode porous transport layer (APTL) on the internal current density and temperature distribution uniformity and energy conversion performance. 800 heterogeneous APTL porosity distributions are applied for CFD calculation, providing dataset for deep learning. The deep operator network (DeepONet) is employed to mapping the heterogeneous APTL porosity distribution to the real physical fields such as temperature, oxygen molar fraction and current density distribution fields. Full-connected neural network is employed to construct the relationship between the heterogeneous APTL porosity distribution to the performance metrics. The gradient descent algorithm is applied to obtain APTL porosity distributions corresponding to the optimal internal current density and temperature distribution uniformity, respectively. Compared with the uniform porosity distribution, the current density and temperature uniformity are improved by 45.544 % and 26.680 %, respectively, at an average APTL porosity of 0.5.