When you upload an image, wordpress uploads the original as is. It then creates the thumbnail and medium sizes itself with its software from the original (which makes them a second (or third) generation jpg. The large size if I remember correctly, is actually just a "resize" of the original that you uploaded. The greater the difference in size between the original of the "large" size for your theme, the poorer the quality is going to be, and each generation gets worse in quality since jpg is a lossy compression scheme.
The avatars in comments are again resized from the original avatar size that a person uploads so again, there will always be a degradation in quality.
My suggestion is always to do all of your sizing in an image editing program before uploading things. I have even at times uploaded two images: the big size that I want people to see when they click on the image in my post, and then an exact sized image for use in the post (medium, thumbnail, large or whatever size I happen to want in the post).
It is very difficult for wordpress to achieve the quality of a dedicated image editing program. It's not like they can embed PhotoShop into wordpress. The thing is though that even free image editing programs such as "Gimp" typically will produce far better results than what wordpress will give you if you let them do the resizing and resampling.