This is due to a mutation in the skin cell of the elephants’ trunks
Over time trunks became longer so that the variety of functions performed by them could grow. Today, the elephant's trunk is basically a “hand”. It can lift and carry heavy loads, carry liquids like water inside it, pull leaves towards it's mouth and it's for sensory perception ( smell ). It can also be used as a strong defensive tool. Access to all these functions is what triggered the evolution of trunks as highly sophisticated and successful tools of the animal kingdom.