The assignment of purpose to everything is called teleology. Children are native teleologists, and many never grow out of it.