It depends a lot on where the hydrogen is sourced from. Hydrogen that is generated from electrolyzers using renewable power is completely green (and funny enough, called Green Hydrogen), and is a good way to store excess energy from solar and wind.
Oil companies however want to market hydrogen from drilling and refining, which is dirty as hell.
It's an important differentiation to make though. Hydrogen is not inherently bad and will have plenty of green applications. We just have to make sure it's coming from the right places.