An optical semiconductor device, comprising: a semiconductor substrate; a laser element comprising: a structure formed on one surface of the semiconductor substrate and including at least a diffraction grating, an active layer generating light by a current injection, and a refractive index control layer whose refractive index is allowed to be changed by a current injection; and an active layer electrode connected to supply current to the active layer, a refractive index control layer electrode connected to supply current to the refractive index control layer, and a switching electrode connected to supply a switching current (I sw) to the active layer, the electrodes being formed on any one of above the structure and another surface of the semiconductor substrate, and a control unit configured to control the supply of current to the electrodes (92a, 92b, 92c) such that: in a state in which no switching current (I sw) is supplied through the switching electrode to a part of the active layer, a pre-bias current (I drive) for the active layer is supplied from the active layer electrode to the active layer, thereby to generate light from the active layer, and a pre-bias current (I tune) for the refractive index control layer is supplied from the refractive index control layer electrode to the refractive index control layer in advance, thereby to change a refractive index of the refractive index control layer, and then, while supplying an activation current (I act) from the active layer electrode to the active layer, thereby to continue generating light from the active layer, the switching current (I sw) is supplied from the switching electrode to a part of the active layer, thereby to turn on the laser element, wherein halting the supply of the switching current (I sw) turns off the laser element. a semiconductor substrate; a laser element comprising: a structure formed on one surface of the semiconductor substrate and including at least a diffraction grating, an active layer generating light by a current injection, and a refractive index control layer whose refractive index is allowed to be changed by a current injection; and an active layer electrode connected to supply current to the active layer, a refractive index control layer electrode connected to supply current to the refractive index control layer, and a switching electrode connected to supply a switching current (I sw) to the active layer, the electrodes being formed on any one of above the structure and another surface of the semiconductor substrate, and a structure formed on one surface of the semiconductor substrate and including at least a diffraction grating, an active layer generating light by a current injection, and a refractive index control layer whose refractive index is allowed to be changed by a current injection; and an active layer electrode connected to supply current to the active layer, a refractive index control layer electrode connected to supply current to the refractive index control layer, and a switching electrode connected to supply a switching current (I sw) to the active layer, the electrodes being formed on any one of above the structure and another surface of the semiconductor substrate, and a control unit configured to control the supply of current to the electrodes (92a, 92b, 92c) such that: in a state in which no switching current (I sw) is supplied through the switching electrode to a part of the active layer, a pre-bias current (I drive) for the active layer is supplied from the active layer electrode to the active layer, thereby to generate light from the active layer, and a pre-bias current (I tune) for the refractive index control layer is supplied from the refractive index control layer electrode to the refractive index control layer in advance, thereby to change a refractive index of the refractive index control layer, and then, while supplying an activation current (I act) from the active layer electrode to the active layer, thereby to continue generating light from the active layer, the switching current (I sw) is supplied from the switching electrode to a part of the active layer, thereby to turn on the laser element, wherein halting the supply of the switching current (I sw) turns off the laser element. in a state in which no switching current (I sw) is supplied through the switching electrode to a part of the active layer, a pre-bias current (I drive) for the active layer is supplied from the active layer electrode to the active layer, thereby to generate light from the active layer, and a pre-bias current (I tune) for the refractive index control layer is supplied from the refractive index control layer electrode to the refractive index control layer in advance, thereby to change a refractive index of the refractive index control layer, and then, while supplying an activation current (I act) from the active layer electrode to the active layer, thereby to continue generating light from the active layer, the switching current (I sw) is supplied from the switching electrode to a part of the active layer, thereby to turn on the laser element, wherein halting the supply of the switching current (I sw) turns off the laser element.