The SQL Server database engine never does this itself. It's "a feature" that SSMS does this sometimes when doing restores through its UI.
If SQL Server can restore the files to the exact same file path as the original database, it will restore the file in the original spot, without any changes.
If that original location doesn't exist on the restore target (or, I believe if you check the "relocate all files to folder" checkbox), then SSMS tries to dynamically construct the file path and name for the MOVE
clause of the RESTORE DATABASE
command, and in the process may rename your data file.
Depending on your use case and file naming conventions, this may be very helpful. Personally, I find it annoying and prefer to construct the RESTORE DATABASE
T-SQL so that I can have full control/review of the location and file name.