Trees, especially the ones with big branches that touch your house, are a point of entry for pests who wouldn’t normally have access to your home.
Ants, for instance, follow along branches to find food. If they find food on your roof, they will leave trails for other ants to follow. Soon enough, they will start exploring further and find cracks in your house. Bigger pests like squirrels and rats that love to hang around trees can also use the branches as a bridge to your roof. If they find holes that they can squeeze through, the pests will get into your home.
To prevent the entry of such pests into your home, you should carry out regular tree trimming.