12 I perceived that there is nothing better for them than to be joyful and to do good as long as they live; 13 also that everyone should eat and drink and take pleasure in all his toil—this is God's gift to man.
But I am unsure if that is the origin. There are similar snippets a bit like it elsewhere in Bible like in Isaiah 22:13.
Perhaps it was something of an ancient saying that the Biblical writers alluded to.
The context is Isaiah admonishing the wayward Jews for acting like the pagans.
Paul quotes this verse in 1 Corinthians 15:32 - If I fought wild beasts in Ephesus with no more than human hopes, what have I gained? If the dead are not raised, “Let us eat and drink, for tomorrow we die.”
Paul is arguing that if Jesus did not die on the cross for our sins and to give us everlasting life (John 3:16), we all might as well throw a party as the unbelievers do.