Firstly, let's address why files might be hidden in the first place. In macOS, certain files and folders are hidden by default to prevent users from accidentally modifying or deleting critical system files. These hidden files include system files, configuration files, and files that are typically not meant to be accessed or modified directly by users. However, users can choose to show hidden files using the Shift + Command + . (period) shortcut, as you've mentioned.
To change the visibility of files from hidden to unhidden, you can select the files or folders in Finder, then right-click (or Control-click) on them and choose "Get Info" from the context menu. In the Info window that appears, you'll see a checkbox labeled "Hidden." Simply uncheck this box to make the selected files or folders visible again.
As for why this happened in your case, it's possible that the file you opened, worked on, and saved may have been inadvertently moved to a hidden folder or directory, or it may have been marked as hidden during the save process. Alternatively, there could be a system or software-related issue causing files to become hidden unexpectedly.
If you continue to experience issues with files becoming hidden or if you're unsure why certain files are being hidden, it may be worth checking your system settings and preferences, as well as reviewing any recent changes or updates that may have occurred on your iMac. Additionally, reaching out to Official Apple Support may provide further insights or assistance in resolving the issue.