Many studies have shown that hydrogen could play a large role in the energy transition for hard-to-electrify sectors, but previous modelling has not included the necessary features to assess its role. They have either left out important sectors of hydrogen demand, ignored the temporal variability in the system or neglected the dynamics of learning effects. We address these limitations and consider learning-by-doing for the full green hydrogen production chain with different climate targets in a detailed European sector-coupled model. Here, we show that in the next 10 years a faster scale-up of electrolysis and renewable capacities than envisaged by the EU in the REPowerEU Plan can be cost-optimal to reach the strictest +1.5oC target. This reduces the costs for hydrogen production to 1.26 €/kg by 2050. Hydrogen production switches from grey to green hydrogen, omitting the option of blue hydrogen. If electrolysis costs are modelled without dynamic learning-by-doing, then the electrolysis scale-up is significantly delayed, while total system costs are overestimated by up to 13% and the levelised cost of hydrogen is overestimated by 67%.