It's actually pagan in origin (just like everything else in the Bible). Ancient Greece, to be exact.
Full story:
"A WAGGONER was once driving a heavy load along a very muddy way. At last he came to a part of the road where the wheels sank half-way into the mire, and the more the horses pulled, the deeper sank the wheels. So the Waggoner threw down his whip, and knelt down and prayed to Hercules the Strong. 'O Hercules, help me in this my hour of distress,' quoth he. But Hercules appeared to him, and said:
'Tut, man, don’t sprawl there. Get up and put your shoulder to the wheel.'
'The gods help them that help themselves.' "
The biblical concept is opposite, actually.
Proverbs 28:26 "Those who trust in themselves are fools,
but those who walk in wisdom are kept safe."