Hello Konrad Skowronski,
To resolve this, right-click the Start button and select Terminal (Admin) or PowerShell (Admin). Execute the following command to completely strip the corrupted Notepad package from the system: Get-AppxPackage *Microsoft.WindowsNotepad* | Remove-AppxPackage. Once the command completes without red text errors, open the Microsoft Store, search for "Windows Notepad" (published by Microsoft Corporation), and click Install. This process forces Windows to write a fresh AppxManifest.xml and properly re-register the file association capabilities in HKCU\Software\Microsoft\Windows\CurrentVersion\AppPaths.
After the clean installation, navigate to Settings > Apps > Default apps, search for "Notepad," and explicitly set it as the default for .txt, .log, and .json. If you were attempting to manually browse to C:\Windows\System32\notepad.exe and received that error, it is because the "App Execution Alias" is locking that filename. You would need to toggle "Notepad" to Off in Settings > Apps > Advanced app settings > App execution aliases to use the legacy executable directly, but the Store version reset described above is the preferred and most stable fix for Windows 11.
I hope you've found something useful here. If it helps you get more insight into the issue, it's appreciated to accept the answer. Should you have more questions, feel free to leave a message. Have a nice day!
VP