The article states that it was quite close to earth. But still, consider that the earth makes a 360-degree turn each year from that gravitational pull.
The article states that it passed Earth at about 15 million miles distance, which is only close in astronomical terms. Still, looking at the graphic, it could do both: after passing within Mercury's orbit nearly perpendicular to the ecliptic (that is, the plane formed by Earth's orbit around the Sun) the object curved around the Sun and went off at an angle that was much closer to the ecliptic, appearing to pass "under" the Earth as it did. Not sure, but it looks like it then rose above the ecliptic as it went further out, so it was still at an angle to the ecliptic, just a much lower angle than it was when it came in.
All of that is assuming that the graphic is at all accurate. And that I'm looking at it correctly.
