Prepare to spend a little cash on a wild ride. You are about to go from an expensive, Jet-A-enriched glass-and-steel shopping mall to an acoustic-tile-ceilinged underground train pit with a bowling alley on top.
Load up Google Maps and pick the result that has you taking AirTrain to Jamaica, and then a cluster of colorful names including Babylon, Hempstead, Long Beach, Port Jefferson, and Ronkonkoma to Penn Station.
Once in the baggage area of any of the terminals follow the signs for Ground Transportation and then AirTrain. Board (ticketless) a Jamaica Station-bound AirTrain. Do not board a Howard Beach-bound AirTrain. Once at Jamaica Station, swarm with the others to purchase a MetroCard of at least $5 value. I recommend just getting a $20 (plus $1.4536̅6̅ bonus!!!) card for your time here. The UI will try to create a false distinction between an "AirTrain MetroCard" and a normal MetroCard. Do not be fooled. You simply need a card with at least $5 value, and there is nothing special about an AirTrain MetroCard (unless you want to believe.)
The MetroCard is 25 years old! It could rent a car. If you're right-handed, lay it in your palm with the yellow/blue MetroCard side up. Tuck the notch into your thenar eminance. If you always keep the MetroCard side facing you, the magstripe is now correctly oriented for all three possible interactions: a slide (as when entering the subway), a horizontal dip (as on a vending machine), and a vertical dip (as when using the AirTrain turnstiles and local buses.) If you're left handed, snip the MetroCard into bits using your special left-handed scissors.
Vertically dip the MetroCard into the exit turnstile, allow it to be ingested and then wait for it to be expelled from the same reader. (If you've been to Washington D.C., this isn't like that.) Take your card, which triggers the gates to open.
You can now escape the AirTrain system by making a slight left past a Tim Horton's  (don't go down the escalators or stairs) into a Long Island Railroad train station, which will be full to the brim with pigeons. Walk through the pigeon gauntlet, perpendicular to all of the tracks, to about midway across the mezzanine. Locate a Long Island Railroad (LIRR) ticket vending machine and buy yourself a One-Way Off Peak  ticket from Jamaica to Penn Station.
Check the track monitors for the track number of the next (any of the line names will do, they all go the same place) New York - Penn Station bound train. Walk down onto that track and board the train when it arrives. If the doors of the car you wish to board do not open, walk briskly towards the center of the train until you find open doors.
 This is one of the only Tim Hortons I know of in the U.S.A. Consider getting some Timbits!
 Unless it is before 10am, then buy a One-Way Peak ticket.