When something is gainful, it is profitable. In other words, it benefits or rewards the person who is doing it.
You are most likely to come across the word gainful followed by employment. For some reason, most writers use this adjective to describe the working world, and the idea that a job provides a benefit to the worker — usually, in the form of money. Occasionally, you'll see other words replace employment, but they will still mean "work." The root of gainful is the Old French gaaignier, "to earn or gain," and also "to work in the fields or cultivate land."