I am confused as to why the pin is not destroyed when the sensor connects it to ground.
Can someone enlighten me?
It all depends on what the pin is configured to be, an input pin or a output pin. At power up and reset time all pins default to be input pins. Input pins are very high input resistance (high impedenace) so they draw almost zero current for any voltage applied to them between 5vdc and ground. However once you command a pin to be an output pin then it is at all times either an active LOW (0vdc) or active HIGH (+5vdc) level and when connected to external components will sink or source current through the pin. Output pins have a maximum safe current rating and if exceeded, will destroy the pin and possible the chip.
To answer your question specific to the post you referenced, that sensor's C -> E has a high intrinsic resistance; it prevents excess current from running through it so an external resistor is not needed.