People can have trouble losing weight for various reasons. One is due to an eating disorder, such as BED, in which binge-eating is uncontrollable. This would make it exceptionally difficult. Another reason is if someone has very slow metabolism. Slower metabolism means they process food and fluid at a slower rate than others. While it may not always be the cause of weight gain, it often makes it harder for weight loss. A third reason is that sometimes when the calories you gain reach the calories you burn, you can hit a plateau. This makes it so that while you could've been losing 3lbs a week beforehand, now you can barely lose 1 pound in two weeks. Fortunately, eating more fiber, cutting back on carbs, and tracking what you eat can all help to break through a weight loss plateau.
And there are many other reasons. Healthy food is expensive in a lot of places, so some people may not be able to afford it. And food can be a coping mechanism for many people, so it's very difficult to take that away. Also, an unhealthy sleep schedule can slow your metabolism and mess with your eating habits.