Every time I open a file, a second file is created with ~$ written in front of it.
If you open with an office programm or something like that, try to check if you can change the settings how to handle temporary files, versions or backup, might help.
This has nothing to do with Nextcloud and depends entirely on the file type and the application you are using. Microsoft Office and Libre Office, for example, are handling docx and other Microsoft Office files that way. See here: Description of how Word creates temporary files - Microsoft Support
Other applications might have similar mechanisms implemented.