There are three modes and you can switch between them whenever you restart the game, and all three interact with the same universe, with your in-game progress the same in all three.
Firstly "open play" - this is exactly what it sounds like. You can potentially encounter other players that are also in open play mode, there is nothing to stop them attacking you but most of them don't without a valid in-game reason. Unfortunately this is also where you are able to encounter the PewPewPewDieNoob! mindset. However, space is BIG. Once you are away from the well-traveled systems you're much less likely to encounter anyone other than NPCs, let alone the folks looking for PvP action because they will naturally be hanging around closer to the player population centers.
"Private group" is the second mode. In this you will only encounter NPCs and other players in the same group. It is otherwise identical to open play - there is nothing to prevent PvP but there are several groups dedicated to PvE play, where anyone doing PvP anywhere but if they are on different sides in a war zone will get booted from the group.
Finally there is "Solo" - you are still online, you are still in the same universe as every other player and their actions impact what you see and yours impact what everyone else sees - you're just in a private group with no other members, so all you will see are NPCs.
There is also - although it's buggy at the moment - the option to ignore/block another player. If you are playing in open or private group and encounter another pilot who you really don't want to play with again, for whatever reason, adding them to your ignore list will drastically reduce the likelihood that the matchmaking code will put the two of you in the same instance.