The special glass of the pH sensor reacts with the hydrogen ions in the water. This creates a very small difference in voltage between the outside and inside of the bulb causing a weak current between the glass bulb and the reference probe.
The more hydrogen ions in the water (the more acidic it is) the stronger the current.