On the surface, gratitude appears to arise from a sense that you're indebted to another person for taking care of you in some way, but looking deeper, you'll see that the feeling is actually a heightened awareness of your connection to everything else.
Gratitude flows when you break out of the small, self-centered point of view with its ferocious expectations and demands and appreciate that through the labors and intentions and even the simple existence of an inconceivably large number of people, weather patterns, chemical reactions, and the like, you have been given the miracle of your life, with all the goodness in it today.
When you awaken to the truth of this incredible interconnectedness, you are spontaneously filled with joy and appreciation. It is for this reason that one of the most transformative practices you can engage in is the cultivation of gratitude. Contentment, or appreciation for what you have, leads to unexcelled joy, while other yogic texts say that this sense of appreciation is the "supreme joy" that naturally leads to the realization of the Absolute. Thankfully, gratitude can be cultivated. It simply takes practice.