unlock your iPhone, plug the cable in, it will charge now.
this is related to the feature that stops unauthorized access to your iPhone through Lightning Port,
there is a vulnerability in the iPhone Lightning Port that allows an attacker to gain access to the
information (through the Lightning Port) stored on your iPhone while your iPhone is locked.
this vulnerability is patched by disabling access to the Lightning Port after a given period of time when iPhone Locks,
so,
unlock your iPhone, plug it it, it will charge,
or
get a wireless charger