Both are refractive conditions, meaning that they are problems related to how the light is focused as it enters the eye. Ideally, as light enters the eye, without any additional effort, the light would be perfectly focused onto the inside lining of the eye which detects the light, called the retina. The brain would then see a clear view of the world. This person would not need glasses for the distance.
Nearsighted means that with your natural uncorrected vision, you can see closer or “nearer” and further out gets blurry. Nearsightedness or myopia is a refractive defect of the eye lens in which the image is formed in front of the retina not on it. This defect can have people seeing closer objects clearly while distant ones are blurred.
Farsighted is simply the opposite. Farsightedness or hypermetropia or hyperopia is a defect of vision in which closer objects appear to be blurred. It occurs because the eyeball is too short, the lens has incorrect curvature or the cornea is flat.