When games give you achievements or badges for arbitrary accomplishments in a game they are trying to give you a sense of Endowed Progress. There is something called the "Zeigarnik Effect" which states that people are more likely to remember an uncompleted task, than one they have finished. In other words, people have a hard time abandoning a goal, even an artificial goal that the game gives you for no other purpose.
When you see something in a game like, "Defeat 20 enemies to unlock this achievement", the game is giving you an artificial goal and trying to get your brain to put that on its internal to-do list of tasks it needs to finish. These unfinished tasks nag you and make you want to play the game to finish them. Of course, there will always be another goal to replace the one you just finished.
The little red notification dot that you sometimes see in games is another form of this. It's the game trying to tell you that you have something you need to do. If you've ever encountered a red dot that you couldn't make go away, you may know how frustrating it can be to have an uncompleted goal sitting there in the back of your mind.
If these uncompleted goals require grinding
in order to complete them, it can make you spend more time on the game that you would have if you just played the game for the enjoyment of it. Additionally, if you can complete the goals quicker by paying to skip them
, then some people will spend money on artificial achievements that the game puts in place outside of the normal gameplay.
Achievements and badges aren't necessarily a dark pattern. They can be used as a tutorial or training on how to play the game, but when you see achievements that take months to accomplish (collect 10,000 items) then its likely that the game developers are using this dark pattern to give you a sense of obligation to finish a goal.