An operating machine comprising an upperstructure, a work device attached to the upperstructure, and a hydraulic drive: including a hydraulic pump, a swing motor which is operated by pressure oil discharged from the hydraulic pump so as to drive the upperstructure, a parking brake which applies a braking force to the swing motor, a swing direction control valve which controls a flow of the pressure oil supplied from the hydraulic pump to the swing motor, a swing operation tool which operates to change over the swing direction control valve, a pilot pump which supplies a pilot pressure to the swing operation tool, and a connection/disconnection unit which connects/disconnects the swing operation tool to/from the pilot pump; and a parking brake control unit which controls the parking brake so as to apply the braking force to the swing motor when a predetermined delay time has passed since the swing operation tool is brought back to a neutral position from an operation position, the hydraulic drive being characterized in that the parking brake control unit includes: a first parking brake control unit which controls the parking brake so as to apply the braking force to the swing motor when the predetermined delay time has passed since the swing operation tool is brought back to the neutral position from the operation position in a state where the swing operation tool is connected to the pilot pump by the connection/disconnection unit; and a second parking brake control unit which is provided separately from the first parking brake control unit and which operates in conjunction with the connection/disconnection unit to control the parking brake so as to apply the braking force to the swing motor when a shorter delay time than the predetermined delay time has passed since the connection/disconnection unit operates to disconnect the swing operation tool from the pilot pump. including a hydraulic pump, a swing motor which is operated by pressure oil discharged from the hydraulic pump so as to drive the upperstructure, a parking brake which applies a braking force to the swing motor, a swing direction control valve which controls a flow of the pressure oil supplied from the hydraulic pump to the swing motor, a swing operation tool which operates to change over the swing direction control valve, a pilot pump which supplies a pilot pressure to the swing operation tool, and a connection/disconnection unit which connects/disconnects the swing operation tool to/from the pilot pump; and a parking brake control unit which controls the parking brake so as to apply the braking force to the swing motor when a predetermined delay time has passed since the swing operation tool is brought back to a neutral position from an operation position, the hydraulic drive being characterized in that the parking brake control unit includes: a first parking brake control unit which controls the parking brake so as to apply the braking force to the swing motor when the predetermined delay time has passed since the swing operation tool is brought back to the neutral position from the operation position in a state where the swing operation tool is connected to the pilot pump by the connection/disconnection unit; and a second parking brake control unit which is provided separately from the first parking brake control unit and which operates in conjunction with the connection/disconnection unit to control the parking brake so as to apply the braking force to the swing motor when a shorter delay time than the predetermined delay time has passed since the connection/disconnection unit operates to disconnect the swing operation tool from the pilot pump. a first parking brake control unit which controls the parking brake so as to apply the braking force to the swing motor when the predetermined delay time has passed since the swing operation tool is brought back to the neutral position from the operation position in a state where the swing operation tool is connected to the pilot pump by the connection/disconnection unit; and a second parking brake control unit which is provided separately from the first parking brake control unit and which operates in conjunction with the connection/disconnection unit to control the parking brake so as to apply the braking force to the swing motor when a shorter delay time than the predetermined delay time has passed since the connection/disconnection unit operates to disconnect the swing operation tool from the pilot pump.