I mean, obviously I wasn't a slave on Tattooine, but I was a poor kid in a rural community. I figure Ani learned how to fix droids the same way I learned how to fix bikes and computers; I needed it, and couldn't afford a new one, so I had to teach myself how to make it work again, or face going hungry.
A lot of it is... well, kind of like figuring out where puzzle pieces are supposed to fit. Eventually, even if you don't quite know what you're doing yet, you can kind of guess where something is supposed to go. If you have a known good working model to compare to, and a good manual, you can teach yourself all kinds of things if you really need to do it.
That, and he was owned by Watto. Watto, as an employer (fuck that guy generally, but bear with me), had to teach his employee how to operate equipment. How to catalogue his junk and get it working again so it could be sold. Anakin was a smart kid, but he also literally built and scrapped droids for work. He had hours a day and nearly unlimited broken droids to take apart.
I've been accused of wizard shit more than once, and I'm nowhere near the same class as the actual tech wizards. I like to think I know enough to get by and call out bullshit. Honestly, the only gripe I have with how Ani's technical talent was written is that he was unrealistically young. The rest was pretty believable.
The most relatable bit was forgetting to put 3PO's eye back in when he powered him on.