File or directory called ~ (tilde) in the root of my startup volume
Could this be something malicious?
  


No, this is simply a file on your computer that happens to be named the same as a shell expansion. It doesn't have the execute bit set, so can't be executed as a binary file by Terminal. A malicious app probably won't be creating a ~ file in the root of your hard disk.


  
  Can I log what or who wrote the file somehow?
  Can I figure out what's inside it?
  


You won't be able to find out what wrote the file unless it was a process which wrote to the console (/Applications/Utilities/Console.app). You can look for processes which are currently accessing the file with sudo opensnoop -f "/~".

Seeing which processes (if any) are accessing the file may give you an indication as to what is inside the file, or you can open it with a text editor or hex editor and certain phrases might be recognisable to you, which may give you an indication as to 


  
  How can I make sure it is safe to delete this file/directory or whatever it is?
  


If opensnoop says that nothing's currently accessing it and nothing accesses it whilst you use your computer, then you're not breaking anything by removing it. It's not a file that should be there, or is required by the system to function.



For more information about this subject, see this related question:


Tilde (~) File in Macintosh Directory