Anagram minigames (known as Hangman's Gambit ingame) are minigames in which the player must use letters to form a word. The minigame is drastically altered with every game in the series however the basic concept has remained the same.
In Danganronpa 1, they function by pulling 2 words from 23_Anagram.pak. The first word is the actual word and must be formed to pass the minigame. The second word is a fake word usually relating or similar in some way to the real answer.
When displaying letters on the screen that the player can choose the game will decide randomly from either word. The fake word serves to balance the game by ensuring that some letters which aren't present in the actual answer will be chosen.
They work similarly in Danganronpa 2, however DR2 does not use fake words.