do 3d models like grass and trees moving because of wind move because of in game scripts or they move like a gif image on their own
Yes to all of them.
Except gif. I dont know of any game that uses gif animations. They may exist, but idk of any of them.
It really all depends on how you want to do it. Unity and Unreal both have “wind zones” that they use to make foliage specifically move. However there is no reason you couldn’t do it via custom animations or using the physics engine. They also all probably have some script dictating something about it too. Like making grass lay flat when you walk on it.
That’s most likely handled by a script.
Edit: I guess you could say sprite sheets are kinda like a gif, but i would consider them more animations.