In the automotive framework, an accurate assessment of the State of Charge (SOC) in lead-acid batteries of heavy-duty vehicles is of major importance. SOC is a crucial battery state that is non-observable. Furthermore, an accurate estimation of the battery SOC can prevent system failures and battery damage due to a wrong usage of the battery itself. In this context, a technique based on machine learning for SOC estimation is presented in this study. Thus, this method could be used for safety and performance monitoring purposes in electric subsystem of heavy-duty vehicles. The proposed approach exploits a Genetic Algorithm (GA) in combination with Artificial Neural Networks (ANNs) for SOC estimation. Specifically, the training parameters of a Nonlinear Auto-Regressive with Exogenous inputs (NARX) ANN are chosen by the GA-based optimization. As a consequence of the GA-based optimization, the ANN-based SOC estimator architecture is defined. Then, the proposed SOC estimation algorithm is trained and validated with experimental datasets recorded during real driving missions performed by a heavy-duty vehicle. An equivalent circuit model representing the retained lead-acid battery is used to collect the training, validation and testing datasets that replicates the recorded experimental data related to electrical consumers and the cabin systems or during overnight stops in heavy-duty vehicles. This article illustrates the architecture of the proposed SOC estimation algorithm along with the identification procedure of the ANN parameters with GA. The method is able to estimate SOC with a low estimation error, being suitable for deployment on common on-board Battery Management Systems (BMS).