An electronic device comprising: a universal serial bus, USB, connector which is connectable to at least one of a charging device and a USB device through a dual gender; and at least one processor electrically coupled to the USB connector, wherein the at least one processor is configured to: detect a connection of the charging device and the USB device to the electronic device through the dual gender connected to the USB connector, determine whether a detach event occurs in a state where the USB device is connected to the electronic device through the dual gender connected to the USB connector, in response to the detection of the detach event, determine whether a sink attach occurs within a designated time from a time point at which the detach event occurs, wherein the detection of the sink attach within the designated time indicates detecting that the charging device is connected while the USB device is connected, in response to the detection of the sink attach within the designated time, determine a charging voltage satisfying a designated condition, wherein the designated condition is configured based on a maximum voltage supportable by the USB device, and request the charging device to provide the determined charging voltage through the USB connector. a universal serial bus, USB, connector which is connectable to at least one of a charging device and a USB device through a dual gender; and at least one processor electrically coupled to the USB connector, wherein the at least one processor is configured to: detect a connection of the charging device and the USB device to the electronic device through the dual gender connected to the USB connector, determine whether a detach event occurs in a state where the USB device is connected to the electronic device through the dual gender connected to the USB connector, in response to the detection of the detach event, determine whether a sink attach occurs within a designated time from a time point at which the detach event occurs, wherein the detection of the sink attach within the designated time indicates detecting that the charging device is connected while the USB device is connected, in response to the detection of the sink attach within the designated time, determine a charging voltage satisfying a designated condition, wherein the designated condition is configured based on a maximum voltage supportable by the USB device, and request the charging device to provide the determined charging voltage through the USB connector. detect a connection of the charging device and the USB device to the electronic device through the dual gender connected to the USB connector, determine whether a detach event occurs in a state where the USB device is connected to the electronic device through the dual gender connected to the USB connector, in response to the detection of the detach event, determine whether a sink attach occurs within a designated time from a time point at which the detach event occurs, wherein the detection of the sink attach within the designated time indicates detecting that the charging device is connected while the USB device is connected, in response to the detection of the sink attach within the designated time, determine a charging voltage satisfying a designated condition, wherein the designated condition is configured based on a maximum voltage supportable by the USB device, and request the charging device to provide the determined charging voltage through the USB connector.