A hydrogen generator comprising: a raw material gas supply device that is configured to supply a raw material gas containing a sulfur compound; a first desulfurization unit that includes at least one desulfurizer connected to upstream of the raw material gas supply device, the at least one desulfurizer in the first desulfurization unit being filled with a desulfurizing agent for removing at least part of the sulfur compound contained in the raw material gas from the raw material gas supply device; a second desulfurization unit that is composed of at least one desulfurizer disposed downstream of the first desulfurization unit, at least one desulfurizer in the second desulfurization unit being filled with a desulfurizing agent for removing at least part of the sulfur compound from the raw material gas; a reforming unit that is configured to generate a hydrogen-containing gas by reforming reaction between a resulting raw material gas and water, the resulting raw material gas being the raw material gas from which all the sulfur compound is removed by the first desulfurization unit and the second desulfurization unit; a flow rate detector that is disposed between the first desulfurization unit and the second desulfurization unit and configured to measure a flow rate of the raw material gas flowing out of the first desulfurization unit; a water supply unit that is configured to supply the water to the reforming unit; a combustor that is configured to heat the reforming unit by burning at least one of the resulting raw material gas and the hydrogen-containing gas; a combustion air supply device that is configured to supply combustion air to the combustor; a controller configured to control operation of at least one of the raw material gas supply device and the combustion air supply device based on the flow rate measured by the flow rate detector; and a desulfurization temperature detector that is configured to detect a temperature of the second desulfurization unit or an ambient temperature of the second desulfurization unit, wherein the controller is configured to adjust the flow rate measured by the flow rate detector to a preset flow rate based on the temperature detected by the desulfurization temperature detector, thereby controlling operation of at least one of the raw material gas supply device and the combustion air supply device. a raw material gas supply device that is configured to supply a raw material gas containing a sulfur compound; a first desulfurization unit that includes at least one desulfurizer connected to upstream of the raw material gas supply device, the at least one desulfurizer in the first desulfurization unit being filled with a desulfurizing agent for removing at least part of the sulfur compound contained in the raw material gas from the raw material gas supply device; a second desulfurization unit that is composed of at least one desulfurizer disposed downstream of the first desulfurization unit, at least one desulfurizer in the second desulfurization unit being filled with a desulfurizing agent for removing at least part of the sulfur compound from the raw material gas; a reforming unit that is configured to generate a hydrogen-containing gas by reforming reaction between a resulting raw material gas and water, the resulting raw material gas being the raw material gas from which all the sulfur compound is removed by the first desulfurization unit and the second desulfurization unit; a flow rate detector that is disposed between the first desulfurization unit and the second desulfurization unit and configured to measure a flow rate of the raw material gas flowing out of the first desulfurization unit; a water supply unit that is configured to supply the water to the reforming unit; a combustor that is configured to heat the reforming unit by burning at least one of the resulting raw material gas and the hydrogen-containing gas; a combustion air supply device that is configured to supply combustion air to the combustor; a controller configured to control operation of at least one of the raw material gas supply device and the combustion air supply device based on the flow rate measured by the flow rate detector; and a desulfurization temperature detector that is configured to detect a temperature of the second desulfurization unit or an ambient temperature of the second desulfurization unit, wherein the controller is configured to adjust the flow rate measured by the flow rate detector to a preset flow rate based on the temperature detected by the desulfurization temperature detector, thereby controlling operation of at least one of the raw material gas supply device and the combustion air supply device.