Factory droids were programmed with the basic functions they were intended to be used for: Astromechs could repair and do some piloting support, protocol droids could translate, and the likes.
If droids spent enough time without memory wipes, they learned skills (I guess with ease, since they were droids after all). R2-D2 and C-3PO aren't the most average of droids - R2 is for some reason a superhero among astromechs, so we must assume he is one of those rare A* products. C-3PO was built by Anakin so he probably did quite a good job there and added a lot of nice stuff.
Just think of the other droids we saw in the movie - they sucked at anything except being annoying and doing their task (usually at the same time).
Regarding Astromechs: I do believe that having them store hyperspace coordinates, or provide some other bonus to a ship, has been suggested. I presume that if a good enough suggestion is made and is backed up by a significant amount of players, it will be implemented. Only time will tell!