Multiple services including netplan, network-manager, and dhcpd all need to make changes to resolv.conf to reflect current network configuration.
Typically in an ubuntu system, the systemd-resolve and resolvconf services try to juggle this, and you will find that the file /etc/resolv.conf is actually a symlink to /var/run/resolvconf/resolv.conf.
If you want to make permanent changes to this file, you need to make the changes in one of the controlling subsystems, such as netplan or network-manager.
If you don't want that file to be automatically managed, you can delete the symlink and recreate it as a regular file. However, this may break things like VPN, DHCP, and dynamic network changes you get when you move from one physical network to another.