The historical reasons are:
The rail network was developed between the 1830s and the 1880s, while the airport was not developed until the 1940s. The Rockaway line wasn't even part of the subway system until the 1950s, a decade after the airport opened.
When the airport was developed, during the middle of the 20th century, New York City was investing heavily in automobile infrastructure, largely under the influence of Robert Moses, who designed and built most of the city's expressways, and whose "building of expressways hindered the proposed expansion of the New York City Subway from the 1930s well into the 1960s." That the airport is well connected to the road network, but not the rail network, is no surprise.
Multiple proposals to connect the airport to the rail network have been considered and for the most part rejected since the 1960s, starting with the Program For Action and leading to the current AirTrain. Reasons for rejection include
- low ridership projections
- restricted funding, often because of financial crises
- opposition from residents of affected neighborhoods
Some quotations from Wikipedia's AirTrain JFK article:
A railroad link to JFK Airport had been proposed since 1968 as part of the Program for Action, but was not actually implemented for almost three decades. From the 1970s to the early 1990s, various plans surfaced to try to build such a link. Meanwhile, the JFK Express subway service and shuttle buses provided an unpopular transport system to and around JFK. There were 21 failed proposals for rail links to New York City airports during this time.
...
There have been proposals for a railroad link between Manhattan and JFK Airport since 1968, when the Metropolitan Transportation Authority (MTA) proposed an ambitious subway and railroad expansion under the Program for Action. The Program for Action contained a plan to extend the Long Island Rail Road (LIRR) to the airport via the Van Wyck Expressway. ... Many Rockaway and central Queens residents wanted the link to run along the disused Rockaway Beach Branch, rather than along the Van Wyck, so that Rockaways residents could simultaneously get express service to Manhattan.
...
Ultimately, most of the lines for the Program for Action were canceled altogether due to the New York City fiscal crisis of 1975.
The article goes on to describe several other proposals, including:
- Bus rapid transit in 1982, "scrapped ... in the face of near-unanimous opposition from the communities along the route."
- A direct rail link from Manhattan to La Guardia to JFK in 1990, beset with planning problems and questions about whether its benefits justified its costs, that was scaled down in 1995 to the scope of the current AirTrain.
- A 1999 plan for service from the Second Avenue Subway, through the Montague Street tunnel, to Jamaica via the LIRR Atlantic Branch, where it would join the current AirTrain system for access to the airport. (This plan will have to wait at least until the Second Avenue Subway is complete; it would also require building a new connection from the subway system to the LIRR at Atlantic Terminal.)
In short, it isn't accurate to say that direct trains to JFK are "not allowed." Everybody agrees that they would be great. The problem is that it has proven impossible to develop a politically acceptable plan to bring that about in a cost-effective manner.