When combined, the characters literally mean “According to (one's) wish, (it is) thereby fulfilled.” The idea is that reality has finally matched one's long-held desire, bringing a sense of completeness and satisfaction.
In Chinese culture, there is a strong emphasis on perseverance, long-term planning, and enduring hardship (吃苦, chīkǔ) to achieve a goal. 如愿以偿 is the ultimate payoff for that struggle. It encapsulates the cultural value that worthy goals take time and effort, and the eventual success is all the sweeter for it. A Western cultural comparison might be the phrase “a dream come true,” but 如愿以偿 often carries a heavier weight of prior effort or waiting. While “a dream come true” can happen by pure luck (like winning the lottery), 如愿以偿 almost always implies that the person was actively wishing, hoping, and often working towards this outcome. It's less about a magical “wish upon a star” and more about the deeply satisfying conclusion to a personal journey or quest.
如愿以偿 is a relatively formal idiom. You're more likely to hear it in a speech, read it in an article, or use it when discussing major life events, rather than in casual, everyday chat.