From an environmental standpoint, a rocket should be hydrogen-fueled. When hydrogen is burned, it is combined with oxygen from the surrounding environment, leaving just water vapor in the exhaust. Water vapor diffuses harmlessly through the atmosphere and has no effect on climate change or other environmental problems.
Hydrogen rockets are also a proven technology that propelled the US to the moon, indicating that hydrogen rockets might be used for space missions.
Due to the small size of the molecule, it is extremely difficult and expensive to ensure that a rocket does not simply leak its fuel. Each weld must be flawless. Each seam must be meticulously sealed. All fittings and joints, from tanks to engines, must be completely sealed.
All of that striving for excellence entails significantly more labor, money, and even risk.
The second issue with hydrogen is that it increases the brittleness of metal. This increases the expense of securely constructing a hydrogen rocket yet again.
Additionally, there are issues with the fuel’s poor energy density in comparison to other fuels, temperature control, cost, and complexity of the equipment required to manage it efficiently.
So today rocket use the next best fuel which is methane (the purest type of “natural” gas). When burned, it does create carbon dioxide, but that is essentially all it produces (other than water vapor, like any combustion reaction). In comparison to RP-1 or other rocket fuels, it contributes to greenhouse gas emissions but does not emit other contaminants.
Given the high expense of hydrogen and the fact that methane is just slightly worse, choosing methane was a no-brainer, even though it is not environmentally friendly.
Reference- Clean Technica, ProVsCons website, NASA website, SpaceX website