Stored Cross-Site Scripting (XSS) occurs due to missing input validation and output encoding on the directory name parameter in the File Manager's Create Directory feature. This allows the execution of malicious scripts without requiring user interaction.