Hydrogen production modules (HPMs) play a crucial role in harnessing abundant photovoltaic power by producing and supplying hydrogen to factories, resulting in significant operational cost reductions and efficient utilization of the photovoltaic panel output. However, the output of photovoltaic power is stochastic, which will affect the revenue of investing in an HPM. This paper presents a comprehensive analysis of HPMs, starting with the modeling of their operational process and investigating their influence on distribution system operations. Building upon these discussions, a deterministic optimization model is established to address the corresponding challenges. Furthermore, a two-stage stochastic planning model is proposed to determine optimal locations and sizes of HPMs in distribution systems, accounting for uncertainties. The objective of the two-stage stochastic planning model is to minimize the distribution system’s operational costs plus the investment costs of the HPM subject to power flow constraints. To tackle the stochastic nature of photovoltaic power, a data-driven algorithm is introduced to cluster historical data into representative scenarios, effectively reducing the planning model’s scale. To ensure an efficient solution, a Benders’ decomposition-based algorithm is proposed, which is an iterative method with a fast convergence speed. The proposed model and algorithms are validated using a widely utilized IEEE 33-bus system through numerical experiments, demonstrating the optimality of the HPM plan generated by the algorithm. The proposed model and algorithms offer an effective approach for decision-makers in managing uncertainties and optimizing HPM deployment, paving the way for sustainable and efficient energy solutions in distribution systems. Sensitivity analysis verifies the optimality of the HPM’s siting and sizing obtained by the proposed algorithm, which also reveals immense economic and environmental benefits.