Why can myopic eyes focus on nearby objects, but not on distant ones?
There are four common refractive errors, namely nearsightedness (myopia), farsightedness (hyperopia), astigmatism (Fig. 1) and presbyopia.


Fig. 1. Refractive errors. source: Excimer Ophthalmologic Clinic 

myopia (nearsightedness): The eye ball is too long, or the cornea too steep, causing light to focus in front of the retina and making distant objects appear blurry.

hyperopia (farsightedness): The eye is too short, or the cornea too flat, causing light to focus behind the retina and making near objects appear blurry.

Astigmatism: is caused by an irregular cornea or lens, causing images both near and far to be distorted or blurry.

Presbyopia: a common age-related problem that is caused when the natural lens in the eye loses its elasticity, making it difficult to focus on near objects (hyperopia).

Focusing of the retinal image is mainly regulated through the process of accommodation (Fig. 2). Accommodation is mediated mainly by changes in the shape of the lens. A more globular lens results in a larger refraction of the light to focus on near objects. A flat lens refracts light less and is suited for focusing in the distance. 

The lens is held in place by the suspensory ligaments. The ligaments in turn are attached to the ciliary muscle (Fig. 2). When the ciliary muscle contracts, it shortens. This effectively moves it closer to the lens and so any tension in the suspensory ligaments is released as the ligaments go slack.  Slack ligaments mean the lens adopts a more globular shape. 

When the ciliary muscle relaxes, this changes its position to increase the tension in the suspensory ligaments. Taut suspensory ligaments (caused by the relaxed muscle) will pull the lens into a long thin shape.


Fig. 2. Accommodation. source: PMG Biology

In the case of myopia, objects in the far distance are blurry. Objects far away tend to send near-parallel light rays onto the lens and the lens needs to be maximally flat and hence the ciliary muscles should be maximally relaxed. If in this case the image is still in front of the retina, the lens cannot relax any further and hence the image is blurry. Because there is enough dynamic range for the ciliary muscles to contract, there is not any problem with objects close by, because the lens is perfectly capable of assuming a concave (fat) shape.