You can get very confused coming from a PHP world to JavaScript, mostly because you can write JS everywhere.
I believe you can master it by taking a step back and understanding what's going on in the first place.
With JavaScript you can work with many architectures, this is why is so good. Here's a few examples:
You can have an API written with NodeJS and another React application running on the front-end. You will end up with 2 servers or 2 processes running in 1 server.
You can also have a monolith, which I believe you are already used to it. When you run both your interface and logic + database in one application. So you will end up with 1 server.
You can also have an Isomorphic (Universal) application, where you combine the power of front-end and the rendering of the back-end (It's possible with JavaScript, since it's the same language). With this you can even choose if you want to separate the API into a different application or write the logic into the same app.
And which way you decide to architecture your application, every time you use a scaffold tool like create-react-app etc. You will end up running a server to start your application, because it's way more convenient when developing. But it's totally doable developing the old way, importing everything on the header of your HTML etc.
But when you finish developing and building your application, on the front end, these tools will generate an index file and all the final boilerplate for you, so it can be as simple as copying to a FTP server and checking your domain.
But if you build a NodeJS application, you will need a server, like Apache or Nginx, the same way you run your PHP code.
JavaScript is a really powerful programming language, and it is so flexible that it can get really messy. But the bottom line is: You have to learn about application architecture.
I really recommend you taking a course from basic to advanced to better understand this. Here's one: