Start by googling some slo-mo videos of barrels being fired, focus on the ones that show the barrel moving. Watching how the barrel moves will improve your understanding of the issue.
Old school was to fully bed the barrel in the fore-end, and to this day, a perfectly bedded rifle barrel that has consistent, even contact between the wood and the barrel is the sign of a high quality, well made rifle.
The problem with this is that wood is dynamic, and can and will change dimensions with changes in the environment. A rain storm might cause the stock to swell, cold could shrink it, all affecting the point of aim. Much time and effort was spent selecting high density, straight grained wood, and carefully fitting it to eliminate pressure points, then doing everything you could to weather proof it , back when wood was the standard for stocks. Good custom stock makers hand selected the piece of wood with precise vision of how the grain would affect the final product. Laminated wood is much more stable than natural wood, for the most part.
The solution was to free float the barrel, so it doesn't touch the wood and cannot be affected. This works best with fairly stiff barrels, often thin sporter barrels like a little pressure midway down their length to stabilize them and dampen some of the harmonics. this led some manufacturers to leave a high spot in the barrel channel at the end, and gun tinkerers have gone as far as to imbed machine screws in the forend to adjust pressure on the barrel or epoxy bed the barrel at the end.
Cheap plastic stocks will not be affected by weather, but will flex and can change their contact with the barrel from pressure on the rest, or a sling.
Generally, todays school of thought is that the less interference there is with the barrel, the more accurate it will be. So modern cheap rifles come with free floated barrels, higher end rifles come with stiff composite and aluminum stocks that are free floated, and even wood stocked rifles are often free floated.
The receiver, on the other hand, needs to bedded firmly into the stock, and accuracy seekers commonly epoxy or fiberglass bed the receiver to lock it into the stock to provide an anchor point for the barrel. often the first couple of inches of the barrel are bedded also. Many modern accuracy stocks use either aluminum pillars, or an aluminum bedding block to facilitate this, and the dedicated will skim coat these with epoxy or the like as a final step for a perfect fit.
In ARs, the only bedding to be done is perhaps truing the receiver where it meets the barrel, and adding a freefloat tube to eliminate the contact at the midpoint of the barrel, although some fanatics will use lock tite and the like to " glue " the barrel into the receiver.
Basically, your goal is to provid a rock solid base( receiver mated to stock) as an anchor point to attach the barrel, then have the barrel able to repeatedly perform exactly the same every time it's fired, usually by eliminating any interfering contact.
ETA: as a rule, stiffer barrels are more accurate, so very accurate rifles often have a heavy barrel, and shorter barrels. There are some exceptionally accurate rifles with long thin barrels, but it's easier to get accuracy, or more properly, precision, from a short, stiff, free floated barrel.
Accuracy: hitting where you aim.
Precision: being able to perform the same every time.
Get Both!