A lot of the electricity probably came from burning natural gas at the power plant, and then some of that (~5%) gets lost in transmission. If we assume the natural gas plant is 60% efficient at turning gas into electricity, then an electric heating element in a hot water tank at your house would be about 55% efficient.
A typical gas furnace is about 80% efficient at turning gas into hot fluid, and a good one can reach 95% efficiency.
Depending on the fuel mix of your local grid, there’s a good chance that burning natural gas at home will result in less pollution than using electric resistance heaters, either for heating water or the air inside your home during winter. Places like Washington state that generate most of their electricity from hydroelectric power plants will be exceptions.
However, heat pumps can be higher than 100% efficiency. They don’t use electricity to generate heat, they just move heat from one place to another. You’ll produce fewer emissions overall by using an HVAC heat pump to heat your house, and a heat pump water tank for hot water. Even if you live in a place like Canada, you can reduce emissions by installing a dual-fuel system that will use electricity to run the heat pump weather permitting, and fall back to using gas when the outdoor temperature goes too far negative.
Using heat pumps to move heat from outside, to inside your house, to inside your hot water tank is more efficient than using gas to heat your home and water, even when the electricity to run the heat pump is generated by burning natural gas.
Welcome to rural talk radio.