Have a look at the wikipedia article for "In situ resource utilization". This is exactly what you're talking about, creating fuel on another planetary body.
https://en.wikipedia.org/wiki/In_situ_resource_utilization
Note that this is a fundamental part of "Mars Direct", one of the most popular ideas for a manned mission to Mars.
https://en.wikipedia.org/wiki/Mars_Direct
The way this would work is actually you would take liquid hydrogen with you, and combine this with carbon-dioxide from the atmosphere to make Methane (CH4) and Oxygen (O2). This is known as the Sabatier Reaction.
https://en.wikipedia.org/wiki/Sabatier_reaction
This can be done, as Robert Zubrin demonstrated in 1993, building an example system that ran at 94% efficiency for $47,000. The advantage of this is that Hydrogen makes up only 5% by weight of methane, so using 6 tonnes of hydrogen you can create more than 100 tonnes of fuel in the end.
This makes the mission much easier to handle, as the more fuel you need to carry with you to get there, the heavier your craft needs to be.
There are also engines known as a "Microwave Electro-Thermal (MET) thrusters". (https://www.researchgate.net/publication/3166116_The_microwave_electro-thermal_MET_thruster_using_water_vapor_propellant). These are primarily aimed for in vacuum engines, but as others have pointed out, Hydrolox fuel has been used throughout history for in-atmosphere engines too.