Achievement unlocked originated in computer games and spread to other applications such as Foursquare, via gamification, the process of encouraging participation through turning something that's not a game into a game (for example, Stack Exchange gamifies asking and answering questions with rep points and badges). From there, it was used as on sites such as Twitter either as a mocking joke on when achieving something unimportant or funny, or just doing something slightly noteworthy.
Computer games
Wikipedia says:
In video gaming parlance, an achievement, also sometimes known as a trophy, badge, award, stamp, medal or challenge, is a meta-goal defined outside of a game's parameters. Unlike the systems of quests or levels that usually define the goals of a video game and have a direct effect on further gameplay, the management of achievements usually takes place outside the confines of the game environment and architecture.
...
Some players pursue the unlocking of achievements as a goal in itself, without especially seeking to enjoy the game that awards them.
Xbox 360
The wording "achievement unlocked" was used in the Xbox 360 (released November 2005). Here's examples from early 2006: 2nd, 10th, 17th and 21st January and 22nd February. The last is on the website Xbox360Achievements which lists the achievements available in Xbox 360 games.
Foursquare
The location-based, social networking website Foursquare awards people with "unlocked badges" when you check in to places. For example, you get the Local badge for checking into the same place three times in a single week. People often post these achievements to Twitter, or rather, they're automatically posted.
Twitter
You can find "achievement unlocked" on Twitter, sometimes as a hashtag. Some recent examples:
KleverKevin:
Achievement unlocked: Not falling asleep in Mrs. Peterson's class
ws:
Achievement unlocked: Wrote 500 lines of code without executing it once.
Just ran it, works 100%.
MegaRan:
3 songs to complete this week and then I'll have finished 3 EP's in one month. #AchievementUnlocked