I would also think that the tree trunks (and utility poles, etc) are painted white to make them more visible so vehicles doesn't crash into them on unlit streets at night.
LOL been asked and answered lots recently. To protect the bark, which can be effected from sun damage, to deter insects, stop dogs weeing on them etc etc