In the Letter of James we hear something that may come as a surprise to many. Too many people still generalize the story of Job and think the temptations that they experience are "the work of the devil" or even "God is testing me." James gives us a simpler but less satisfying answer to the question.
No one experiencing temptation should say,
"I am being tempted by God";
for God is not subject to temptation to evil,
and he himself tempts no one.
Rather, each person is tempted when lured and enticed by his desire.
Then desire conceives and brings forth sin,
and when sin reaches maturity it gives birth to death.
That's right; temptation comes from our own desire. The reason I call it a less satisfying explanation is that it gives us no room to put the blame on anyone or anything outside our own self.
James gives a simple track of temptation: desire -> sin -> death.
The simple truth is that in our own hearts we desire things that are not good, and things that are not good for us.
The good news is that while the temptation doesn't come from God the answer to it does. God's grace can help us to deal with the desire that we feel. St. Thomas would point out that grace helps us to know what is right, desire what is right, and actually do it.