Solar flares and coronal mass ejections, the primary space weather disturbances affecting the entire heliosphere and near-Earth environment, mainly emanate from sunspot regions harbouring high degrees of magnetic twist. However, it is not clear how magnetic helicity, the quantity for measuring the magnetic twist, is supplied to the upper solar atmosphere via the emergence of magnetic flux from the turbulent convection zone. Here, we report state-of-the-art numerical simulations of magnetic flux emergence from the deep convection zone. By controlling the twist of emerging flux, we find that with the support of convective upflow, the untwisted emerging flux can reach the solar surface without collapsing, in contrast to previous theoretical predictions, and eventually create sunspots. Because of the turbulent twisting of magnetic flux, the produced sunspots exhibit rotation and inject magnetic helicity into the upper atmosphere, amounting to a substantial fraction of injected helicity in the twisted cases that is sufficient to produce flare eruptions. This result indicates that the turbulent convection is responsible for supplying a non-negligible amount of magnetic helicity and potentially contributes to solar flares.