Do you knit a tension square/gauge swatch?
Patterns will have a tension listed at the start of the pattern, showing how many stitches and how many rows make a square - usually of 4 inches/10cm.
If you have too many or too few stitches or rows your garment will come out bigger or smaller than the pattern. You can adjust this by changing the yarn, or using bigger or smaller needles, or simply by knitting a different size.
It's a pain knitting a tension square when you really want to crack on with the garment, but it's worth it in the end, as you are far more likely to end up with a useful item.
If any of that isn't clear, please let me know and I'll try to explain in a different way.