Anakin built C-3PO to be his friend
CANON: In the Revenge of the Sith novelization by Matthew Stover, when he offers C-3PO to Padme, Anakin says he built C-3PO to be his friend since he didn't have many friends as a child.
Without anything of his own to give except his love, all he could bring her was a friend.
"I didn't have many friends when I was a kid," he'd told her, "So I built one."
And C-3PO had shuffled in behind him, gleaming as though he'd been plated with solid gold.
Padme had lit up, her eyes gleaming, but she had at first tried to protest. "I can't accept him," she said. "I know how much he means to you."
- Revenge of the Sith p. 113
In The Phantom Menace, back when he barely knew Padme, Anakin claims to have built C-3PO to help his mother. However, this could simply have been his justification he provided adults. After
creeping on getting to know, falling in love with, and marrying Padme, he finally reveals that his personal motivation for building C-3PO was actually to fashion himself a friend. His personal reason for building him was to stave off loneliness. Any help C-3PO would be able to provide Shmi was likely just an added bonus.