Use Assign To in the app's Dock menu. It takes three steps, and it works per app, not per window. Here's how it works, where it stops, and another way to keep each app's windows where they belong.
How to assign an app to a desktop.
Three steps. Apple describes them in its guide to working in multiple spaces.
Switch to the desktop you want the app to open on.
Control-click the app's icon in the Dock and choose Options.
Under Assign To, pick This Desktop. The app now opens only in the current space.
The four choices.
All Desktops opens the app in every space. This Desktop opens it only in the current one. Desktop on Display does the same for a specific display, if you have more than one. None opens it in whichever space you're using at the time.
Move a window that's already on the wrong desktop.
Drag it to the edge of the screen, or open Mission Control and drag it up to the space you want.
What Assign To doesn't do.
It decides where an app opens. It doesn't sort the windows you already have.
It's one choice per app.The menu lives on the app's Dock icon, so you can't give one Safari window to one desktop and another to a second desktop.
You can still get thrown.With the Mission Control setting on, which it is by default, switching to an app moves you to a desktop with its windows. See how to stop your Mac switching desktops.
Existing windows stay put.Moving one is a drag to the screen edge or up to a space in Mission Control.
Full-screen apps pick their own desktop.Apple says a full-screen app appears in its own space.
Another way
Ask for an app. Get it right here.
Without RotaraFirst without Rotara: a Dock click on Safari slides you to the desktop where Safari already has a window. Then with Rotara: a new Safari window opens right here, in this project.
Rotara doesn't pin apps to desktops. It gives each project a workspace on one desktop, and every window belongs to one of them. Click an app in the Dock, and if all its windows are in other projects, Rotara opens a new window of it right here. An app with no New Window command, such as Calculator, takes you to its project instead.
Sending a window to the right project.
Two clicks in the workspace pie, which opens with ⌘ ⇪.
Move it and follow it.⇧-click a workspace and the window you're in goes there, and you go with it.
Move it and stay.⌃⇧-click sends it and keeps you here, so you can send several in a row.
Pinned apps are the exception.An app you pin, such as Spotify, belongs to every project, which is the nearest thing to Assign To's All Desktops.
Different rules than desktops.There's no way to say "this app always opens in that project". It opens in the one you're in.
Compare
Assign To and Rotara.
Two ideas of where an app should open.
Assign ToThis Desktop
Rotara
An app always opens in one fixed place
Windows of one app can sit in different places, set per window
A Dock click opens the app where you are
Built into macOS, no cost
When Assign To is enough.
If an app has a home, such as mail on desktop 1, it's free and it works.
Go to the desktop you want, Control-click the app's icon in the Dock, choose Options, and under Assign To pick This Desktop. Apple says the app then opens only in the current space.
What do the Assign To choices mean?
All Desktops opens the app in every space. This Desktop opens it only in the current space. Desktop on Display opens it in the current space on a specific display, if you have more than one. None opens it in whichever space you're using at the time.
How do I move a window to another desktop?
Drag the window to the edge of the screen, or open Mission Control and drag it up to the space you want.
Can Rotara open an app on a specific desktop?
Rotara doesn't use desktops. It opens an app right where you are, in the project you're working in, and lets you send any window to another project with a click in its workspace pie.
Stay in the project you're in.
Try Rotara free for 14 days. Every project gets its own windows, and a Dock click opens the app right where you are.
Free for 14 days, no account or card. Then $19 to keep it, the early-bird price until Dec 31 (normally $29). Quit anytime and every window comes back. Requires macOS 13 or later.