but it seems to produce too great error for the time of encounter - the minimal distance much greater than the one currently predicted and the asteroid is depicted to pass the Earth's orbit in front of the Earth, which seems wrong - the semi-major axis of the asteroid is supposed to increase.

Did you read the fine print regarding that applet? "This applet is provided as a 3D orbit visualization tool. The applet was implemented using 2-body methods, and hence should not be used for determining accurate long-term trajectories (over several years or decades) or planetary encounter circumstances. For accurate long-term ephemerides, please instead use our Horizons system."

The reason there is an error using the JPL widget is that it is using today's orbit on a day far away into the future. Asteroid orbits are not immutable and vary over time due primarily to planetary encounters and the effects of sunlight. It many cases we also don't know the orbit of an asteroid so well that we can predict where it will be in 100 years with high precision (or maybe even 10 years).

If you want to use John Walker's diagram, you would need Apophis's orbital elements in 2029. The good news is the MPC Ephemeris service provides orbital elements at future dates. The bad news is we don't provide them in the 8-line format John's program wants, but only in 1-line format. The good news is we're planning to offer 8-line format with the next version of the Ephemeris script. The bad news is I don't know when the release date will be, but most likely before Apophis's flyby in 2029.

Yes, the 8-line option is there, but it only affects the orbital elements for the current epoch. If you scroll down to the bottom of the results page you should see the 1-line version of the orbital elements at the future date you requested (assuming you filled out the 'Also display elements for epoch' box near the bottom of the Ephemeris request page).