I would use unity and as target I would set javascript :). The question is do you want to build a game or you want to build the game engine.
For the game engine I agree with M C++ is the dominant language but it does not have a good compile target in WASM which lead to one of the things Marco Alka mentioned Rust
Rust is close to equal to C++ at least one of the talks of the last meetups was about a guy writing his master thesis by porting his game engine from C++ to Rust.
There are also pretty decent engines written in JS threejs.org for example.
Open or closed source is business decision. Flip a coin if you are not sure ;) you can always move between them if you pick the right licensing model.
Besides that I think Marco Alka is way more competent in this topic than I am. But most of my game developer friend use unity and unity added a new FPS sample unity.com/fps-sample where you can explore things.
I still guess that might be overwhelming for a beginner . I just implemented isomorphic top down arcade space shooter based on tutorials or a sidescroll game with GML .... and I am most likely overwhelmed.
But again first pick your tools and make the decision if you want a game or a game engine they relate to each other but they don't necessarily need to mix :)