The invention belongs to the field of marine technical equipment, and particularly relates to an automatic floating device of an underwater robot and a method for controlling the automatic floating device. The method includes that faults such as water leakage can possibly occur due to complexity of work environments of the underwater robot, the underwater robot urgently needs to float out of water surfaces, water leakage signals can be detected by a water leakage sensor inside the underwater robot at the moment, and can be transmitted to a central controller, signals can be transmitted to an igniter after the signals are processed and judged by the central controller, the igniter can be activated and carries out ignition to initiate chemical reaction, a large quantity of gas can be generated instantly, is filtered by a filter and then flows into a gas bag, a gas bag cover can be flicked after the gas bag is quickly expanded, the gas bag is immediately unfolded right above the underwater robot, the volume and buoyancy of the underwater robot are increased after the gas bag is unfolded, and the underwater robot can ultimately float out of the water surfaces under the effect of net buoyancy, can be timely found by staffs under the assisting effect of a GPS (global positioning system) positioner and can be recovered. The automatic floating device and the method have the advantages that the automatic floating device is simple in structure and can work reliably, and the response capacity of the underwater robot under special conditions can be greatly improved.