You did nothing wrong. My guess is that you did a partial boil, and topped off your fermenter to 5 gallons (or whatever) with water, then you took your gravity reading. When you did this, the liquid on the top of the fermenter is typically lower gravity than the extract-laden liquid on the bottom. They will ultimately blend together via convection and fermentation activity, but it takes a while.
One way to get more accurate readings is to more thoroughly mix up your wort before taking the sample.
The other possibility is that you took the hydrometer reading when the wort was still quite warm. Temperature has an effect on the reading. You can correct for different temperatures up to a point, but it is generally better to wait until the wort cools. Although, based on the numbers you posted (1.030 and 1.050), the wort would have to be pretty hot to get that big of a difference in readings.