If your old cellphone is not charging the battery may be broken. However there is a method to try to recover it.
The charger has got a voltage detector and if the battery voltage is too low it will stop charging, the battery has similar protectors integrated. If your phone starts charging but after one or two seconds it stops you have to try charging it many times unplugging and plugging the charger. Every time you try the current may pass to the battery for a second or so, so after trying many times we may increase the voltage of the battery to a normal level so that the charging can continue. If you are patient you may revive your old cellphone or any other battery powered device that has not been used for a long time.
I have tested this several times and it has helped me revive a few dead batteries, however this approach may not work depending on the device and charging protections it is using. The battery may also be completely broken, in that case this will not work.