A door opening and closing device includes a motor that outputs driving force causing a back door of a vehicle to be opened or closed, and a controller that controls the motor. The controller executes automatic opening and closing control for automatically opening or closing the back door by the motor, and if the controller detects a stop command causing the back door to be stopped when the automatic opening and closing control is being executed, the controller decreases a target velocity of the back door at a predetermined deceleration α1 until the back door stops.