A hot water generator comprising: a refrigerant circuit formed by annularly connecting, through a refrigerant pipe to one another, a compressor for compressing refrigerant, flow path switching means for switching flowing directions of the refrigerant, a first heat exchanger for exchanging heat between the refrigerant and liquid, a decompressor for decompressing the refrigerant, and a second heat exchanger for exchanging heat between the refrigerant and air; a bypass passage, an opening and closing device for opening and closing the bypass passage; and a control device for executing a plurality of operation modes, characterized in that the bypass passage is for connecting the refrigerant pipe between a discharge side of the compressor and the first heat exchanger to the refrigerant pipe between the decompressor and a suction side of the compressor, or to a compression chamber of the compressor, and in that the control device is for executing the following operation modes: a first operation mode for making the refrigerant discharged from the compressor flow into the second heat exchanger through the flow path switching means, and for closing the opening and closing device, and a second operation mode for making the refrigerant discharged from the compressor flow into the first heat exchanger through the flow path switching means, and for opening the opening and closing device, and wherein the control device is configured to shift the operation mode to the second operation mode, when temperature of the first heat exchanger becomes lower than predetermined temperature during the first operation mode. a refrigerant circuit formed by annularly connecting, through a refrigerant pipe to one another, a compressor for compressing refrigerant, flow path switching means for switching flowing directions of the refrigerant, a first heat exchanger for exchanging heat between the refrigerant and liquid, a decompressor for decompressing the refrigerant, and a second heat exchanger for exchanging heat between the refrigerant and air; a bypass passage, an opening and closing device for opening and closing the bypass passage; and a control device for executing a plurality of operation modes, characterized in that the bypass passage is for connecting the refrigerant pipe between a discharge side of the compressor and the first heat exchanger to the refrigerant pipe between the decompressor and a suction side of the compressor, or to a compression chamber of the compressor, and in that the control device is for executing the following operation modes: a first operation mode for making the refrigerant discharged from the compressor flow into the second heat exchanger through the flow path switching means, and for closing the opening and closing device, and a second operation mode for making the refrigerant discharged from the compressor flow into the first heat exchanger through the flow path switching means, and for opening the opening and closing device, and wherein the control device is configured to shift the operation mode to the second operation mode, when temperature of the first heat exchanger becomes lower than predetermined temperature during the first operation mode. a first operation mode for making the refrigerant discharged from the compressor flow into the second heat exchanger through the flow path switching means, and for closing the opening and closing device, and a second operation mode for making the refrigerant discharged from the compressor flow into the first heat exchanger through the flow path switching means, and for opening the opening and closing device, and wherein the control device is configured to shift the operation mode to the second operation mode, when temperature of the first heat exchanger becomes lower than predetermined temperature during the first operation mode.