To hide it
He hints at this in his conversation with Harry in Deathly Hallows (emphasis mine):
"Maybe a man in a million could unite the Hallows, Harry. I was fit only to possess the meanest of them, the least extraordinary. I was fit to own the Elder Wand, and not boast of it, and not to kill with it. I was permitted to tame and use it, because I took it, not for gain, but to save others from it.
Harry Potter and the Deathly Hallows Chapter 35: "King's Cross"
The Elder Wand left a long and bloody trail across history, and Grindelwald proved that it could be immensely dangerous in the wrong hands. By keeping it for himself, Dumbledore could prevent it from being misused.
He may also have been hoping that he could, eventually, break its power; Harry suggests this is possible by dying of natural causes while being the Wand's master (emphasis mine):
"I'm putting the Elder Wand," [Harry] told Dumbledore, who was watching him with enormous affection and admiration, "back where it came from. It can stay there. If I die a natural death like Ignotus, its power will be broken, won't it? The previous master will never have been defeated. That'll be the end of it."
Harry Potter and the Deathly Hallows Chapter 36: "The Flaw in the Plan"
This doesn't entirely explain why he insisted on using it, rather than putting it inside a mirror or something. There's no answer to that in canon that I know of, but some plausible theories include:
- Keeping it on his person is the most effective way to keep it safe
- He could use its power for beneficent purposes