Orbiter Space Flight Simulator is a classic comprehensive 3D space flight simulator and the developer has recently made it open source as they've haven't had enough time for it.
Worth noting that currently it only supports Windows, and it's a little on the older side with it using DirectX 7. However, since it's now open source under the MIT license, this gives it a much better chance of seeing more developers come along to potential upgrade it and bring it to more platforms like we've seen happen to other projects. There's already some options being talked about to make it more cross-platform friendly.
"Orbiter is a spaceflight simulator based on Newtonian mechanics. Its playground is our solar system with many of its major bodies – the sun, planets and moons. You take control of a spacecraft – either historic, hypothetical, or purely science fiction. Orbiter is unlike most commercial computer games with a space theme – there are no predefined missions to complete (except the ones you set yourself), no aliens to destroy and no goods to trade. Instead, you will get a pretty good idea about what is involved in real space flight – how to plan an ascent into orbit, how to rendezvous with a space station, or how to fly to another planet. It is more difficult, but also more of a challenge. Some people get hooked, others get bored. Finding out for yourself is easy – simply give it a try. Orbiter is free, so you don’t need to invest more than a bit of your spare time."
In the brief announcement the developer mentioned:
This is essentially the 2016 Edition with some minor (and at least one major) fixes. I hope this is of use to somebody. The code is somewhat unorganised and sparsely documented, but it should compile and leave you with a working Orbiter installation. Note that the repository doesn't include all the required planetary textures, so you need to install those separately (e.g. by reusing an existing Orbiter 2016 installation - this is explained in the Readme and only requires setting a CMake option before configuring the build).
You can find the source on GitHub.