The derogatory expression “couldn’t hold a candle” is from the sixteenth century.
Before electricity, experienced workers needing light to work by would have a young apprentice hold a candle so that they could see to complete a complex job.
Holding a candle for a skilled tradesman gave the apprentice a chance to watch and learn, but if he couldn’t even do that properly, it was said disparagingly that “he couldn’t hold a candle” to the tradesman.