Gohan's hidden power was talked about from almost the very first episode of Dragon Ball Z until nearly the very end. As far as he goes, his strength comes from the fact that he was thrown into fighting life and death battles when he was just 4 with the arrival of Raditz and his training under Piccolo. Just look at his resume: Raditz, the Saiyans, Frieza and all his minions, and then Cell. I stop at Cell because that was the last time he seriously trained for any sustained amount of time. But even after that, he stopped training for 7 years and his power decreased to the point where he was "only" a little stronger than Perfect Cell. During the Buu saga, the Old Kaioshin just unlocked the rest of his dormant power. So with all he experienced when he was a kid, it's only natural that he'd be a formidable fighter regardless of how much he's let himself go.
As far as Goten goes, he was being trained by Chichi. She might not be very powerful herself compared to the Z fighters, but she's certainly the strongest female in the world aside from 18. Her training methods were never really discussed but from the one flashback of her sparring with Goten, we can see that she was going pretty hard on him so it wouldn't be too far fetched to think that she'd be able to make him powerful. Like Gohan, he has the hidden power, so it's just a matter of training. The main difference is that Chichi allows Goten to train whereas Gohan had to either sneak off for that or there had to be something threatening Earth.
Sorry for the long explanation but I hope that helps.