When your phone is connected to another device via USB, you may have the ability to select which device is drawing power and which is providing it.  For example, when your phone is plugged into a laptop, it may start supplying power to the laptop, rather than charging.

This article will show you how to select which device is charged, and which is providing power.

View current USB mode
The notification drawer will have a badge showing the current USB mode your device is using.
Tap to change USB mode
Tap anywhere on this notification badge to bring up a menu to select your desired USB mode.
Select USB mode
Your device will display the available USB modes for you to choose from. For example, "Charge this device" to charge your phone.