What are you using for a charger? If a PC/laptop, its USB port is not putting out enough power to charge your phone and power it at the same time. If your PC/laptop has USB 3.0 port, try using it instead as it can output more current. You can tell them apart by their color - USB 3.0 ports are blue:

On many PCs, you will find USB 3.0 ports only on the back of the box as these are connected directly to the system board; the front ports are connected to the system board by way of cable and connectors which (often) cannot support the higher current and speed of 3.0.
If you are using an actual plug-in charger, look at it carefully (you may need a magnifying glass) and see what it says about the output voltage and current specs; come back here and let us know what you find.