Why when I enter bad url wordpress doesn’t return error 404

WordPress will automatically try and guess what the correct URL is. You can disable the feature using the Disable URL Autocorrect Guessing plugin.