The plane has a data connection. You get access to a data connection via the on-board wifi.
You don't see a connection between the two? Let me fill it in for you: they share the same path outside the plane.
Note that this data connection isn't required for the plane to continue flying, but I don't know how it's used by in-cockpit warning or navigational stuff.