I've had to chase after this myself since I was originally self-taught decades before, and in my case, the repertoire that was handed on to me ended up creating the "perpetually curved" hands and rest. I've been working my teacher in unraveling and reshaping this for a few years. Since we're in different countries so there is no hands-on it's been tricky - I've also used additional resources with his approval. Anyway:
Hands: Your default starting point is the relaxed hand as it is when you're arm is hanging down when you stand. The watchword when you're playing piano is that everything works together and interrelates, even your feet are involved in a sense, and secondly that everything moves and changes. So staying with the hands for a second and this "ball-holding shape" idea: If you play a fifth or a fourth with thumb and pinky on the outer keys, your fingers will naturally be quite curved, because how else can they be. If you stretch out to play an octave or 9th or 10th, depending on how big and stretchy your hand is, your fingers will be quite straight because they have to be, to stretch out to those notes. In these two extremes you see how the hand cannot have one shape. Also, black keys are "higher up" than white keys. If you try to keep the same curved fingers while playing an E chord (E G# B - white black white) that G# middle finger will be rather cramped. It's a long finger - our fingers are different lengths.
Hands again: "At the wrist" (don't take this literally!) your hands can move the following ways: up and down (raised or lowered "wrist"), side to side in a sideways swivel motion, and from the forearm so to say it can rotate in a doorknob-opening sense. These three directions give you infinite variations of a circle. These possible motions immediately affect what we can do - for example, if you tip your hand rotationally into the 5th finger, that momentum goes into the finger and thence into the key .. as opposed to a rigid hand and doing it all only with the fingers. It opens possibilities. Or conversely: rigidity narrows possibilities.
From there we have the whole body: the arms with forearm and upper arm and shoulder, and how these work together; the torso and how it is seated, and its role; the hips, shifting weight at your sit bone, and your legs and feet that counterbalance, support, or "weigh down what you're trying to do. These are explorations to do
over time.
The reason I ended up with the round hands, rigid wrist, and motionless arms, which it turns out that my grandmother had been taught - is that I had her books, and the repertoire reinforced these things. If you are playing music mostly on the white keys (G major, F major, C major, and relative minors), mostly with a hand span of a P5 (perfect fifth), and mostly in the middle of the piano, you'll end up with a relatively round hand. You don't need to lean left and right because you're in the middle of the piano, and if you never use the pedal, you don't have to be aware of your feet.
My teacher does not give any "rules" such as the shape of the hands. The only thing he insists on is a good height and distance from the piano, because that sets up a whole bunch of other things. He gives repertoire that soon varies in the sense of using both black and white keys, expanding past a P5, moving all over the piano, and using the pedal.
Students are told to aim for the best sound and the greatest comfort. As they experiment back and forth to find that comfort, their movements go toward something that looks and sounds right. For those of us who got into poor habits, this is a good starting point. You won't know what "greater comfort is" until you've experienced it, because whatever you're doing is your "normal". But when you experience "better", that old normal will feel like cr*p and you won't want to go back to it.
It's a journey. Beware of rules that say this (x) is the only way to move. Two resources I can recommend right away that are on-line:
For a basic understanding of how your body works together, after part by part, and guided exploration, after which he shows a small number of basic motions of notes at the piano, I'd recommend going through the whole gamut of Piano-Ologist's course: it's tedious, slow, and boring, but I learned a lot, since I am quite body-unaware:
Jaak Sikk also has a course up which is tedious but builds things bit by bit: the first month is free. Even better however is a teacher who knows what he is doing in this regard.
The body has to be straight, right? My teacher told me my arms shouldn't be at my side and there needs to be a slightly small gap between my arm and torso. Head should be erect, with the hands straight with the forearms.
Those are general guidelines. But by itself it can leave you like a posed mannequin, when playing itself is fluid. You are moving. Imagine you are - erm - washing the roof of a car, getting at the part that is furthest away from you, closest to you, to the left or the right. Would you keep your body straight upright and only move your arms? Or do you shift your weight in your feet, lean from a central place so you don't topple, and maybe your head does some things too? Sitting and standing upright are in themselves a constant balancing act of micro-movements. We are not "rooted into the earth" like an oak tree, or a house on its foundations.