Look carefully at the palm tree that is acting weirdly. It is a closed path with a fill. Select the layer, press UU, to reveal all modified properties, and move down to the path and you will find a fill. Delete the fill and the weird green pattern goes away.
Thank you for your answer. There was no fill, all paths are outline only.
The problem is caused by the type of outline which was set to external. As long as I've found out, the outline has to be uniform to work with trim path tool. I've achieved that by moving the outline to centre mode, although I'm not 100% happy with the result, so if anyone has a different solution I'm all ears.
Any modifications to the stroked path will cause it to turn into a filled shape when After Effects converts the vector file to a shape because After Effects does not support brushes, inside stroke, outside stroke, or oval brush strokes as shapes. If you had selected the shape layer in After Effects and pressed the U key twice you would have seen that the palm tree was now an inside and outside path that created a filled layer. You can tell it is going to happen to a path in Illustrator if you select the path then choose the Object Menu. If Expand Appearance is available then After Effects will turn that path into a filled shape. That's what After Effects does to a complex path, it expands the appearance.
You could always delete one of the paths and delete the file, then add a stroke to the path right inside the timeline. That would fix your animation without having to go back to AI and fix the stroke. It will offset the path by half of the stroke width but that should be easy to fix.
Check this screenshot of a modified workspace so you can see all the info in the shape layer created by AE when the Red path was set to inside, the green was set to outside, and the blue was just a plain path with a stroke.