This is a simple question to ask but has a longer answer with a ton of complexities you probably don't care about if you are not brewing your own. Ultimately sweet beers are part of the style they are in so avoiding sugary sweet beers is as simple as knowing the styles. You can skip to the bottom if that's all you want to know.
There are two types of sweetness that are often discussed and sometimes confused in beer, a Malty flavor and a Sweet flavor. The same ingredients are involved but in different ways. Sugary sweet beers basically come from unfermented sugars which simply means sugars that the yeast hasn't processed to create alcohol and carbon dioxide. This is also called attenuation.
This can be caused by a few different things such as unfermentable sugars that come from the way the beer is mashed (when the grains are mixed in with hot water and left to sit for a specific length of time) or from specialty grains, or the yeast itself.
The explanation of how the mash affects sweetness is very complex and full of biochemistry. I will try to summarize. Grains are full of starches that need to be converted to sugar for the yeast to ferment. There are two main enzymes involved in this process, alpha and beta amylase enzymes. Using a branched tree analogy works great. After a strong storm you need to clean up your yard from the limbs that have fallen from the trees. You have a lopper (alpha amylase) which is great for cutting the branches apart from the limbs but still leave you with long branches and twigs. You also have a chipper (beta amylase) which is good at taking the branches and twigs and cutting them into little pieces that are easy to use. The two enzymes need to do their work together to make the most fermentable sugars out of the starches stored in the grains. Alpha amylase is good at breaking the limbs apart into long starch chains but these are not easy for yeast to ferment. Beta amylase is great at making small glucose chains that the yeast can convert but the big limbs are too big to get into the chipper, if the alpha amylase doesn't do its job first the beta amylase can't do its job well.
The kicker is each enzyme works in a specific temperature range (beta amylase 131-150°F and alpha amylase 154-162°F). A brewer can manipulate the mash temperature to ensure both enzymes are working with an overlapping temperature (for instance 152°F) or adjust the temperature up or down to accentuate one enzyme over the other. For instance if we mashed at 158°F the beta amylase will denature and not affect the beer, while the alpha amylase will be very happy and busy. This will result in more long starch molecules in the beer which are harder for yeast to ferment and result in a sweeter beer!
Unfermentable sugars can also come from specialty grains added to the beer for flavor and intentional sweetness. The usual suspects are roasted grains where the sugars inside the grain will start to caramelize such as Dark caramel and roasted malts like Crystal 80, Crystal 120, Special B, Chocolate Malt, and Roast Barley. Below is a great place for people to start learning the intricacies of brewing beer at home.
Increasing the Body
Ultimately these things are done by brewers to make their beer fit into the style they are trying to make along with other things like the amount and type of hops used and other adjuncts (stuff added to beer like fruit or rice or...) So to avoid sugary beers you mainly need to know what styles are not sweet or it's as simple as saying know what types of beers you like. If you really want to learn the styles turn to the Beer Style Guide!
2008 BJCP Style Guidelines
Look around and see which are sweet and avoid, meanwhile look for highly attenuated beers. I'd expect some you would like are:
- German Pilsners
- American Lagers and Pilsners
- Berliner-Style Weisse
- Dunkel Weizen/Dunkel Weissbier
- Munich Helles
- Belgian-Style Pale Strong Ale
- Pale Ales shouldn't be too sweet
- IPAs should be dry
If you want to be adventurous, try a Wood- and Barrel-Aged Sour Beer. They are supposed to be dry although I can't speak from experience.