Gas appliance venting into unlined chimneys is not allowed, additionally the chimney connector is inserted excessively into the flue. This is why the water heater is downdrafting as indicated by the burned paint at the combustion chamber.
Chimney needs lining or water heater needs replacement with direct exhaust.