After much struggle, the pilgrims were finally able to grow enough grains and hunt enough meat to pass the winter comfortably. So they decided to enjoy it and thank God for their good luck. They invited their neighbors, the native Americans, and had a great meal. That's the first instance.
Cut to 1863. America is in the midst of a Civil War. President Lincoln proclaims the fourth Thursday of November to be celebrated as Thanksgiving. And that's what is still going on.
I find the idea of Thanksgiving a very secular one; you needn't be a Christian to soak in the spirit of the day. My religious leanings are quite dubious, but I enjoyed it a lot.