Sentinels will only attack if you are attempting to make changes to the area they are residing in, provoking them by messing with the wild life or terrain, or exploring a planet with rare resources.
No Man's Sky - Sentinels
The Sentinels in No Man's Sky are a species of self-replicating, non-organic machines. They were created to balance the efforts and actions of the player with the procedurally generated ecosystem. Sentinels act as the workhorse machines of The Atlas, and police the actions of those within the universe.
They are, in essence, the "gardeners" of the No Man's Sky universe. If the player makes an attempt to alter the environment while they are around, they will not hesitate to defend their "garden".
Behavior and wanted level
Sentinels will normally act passively towards the player unless they witness them violating a universal law (such as killing an animal unprovoked, or over-mining a planet's resources). This behavior will accrue wanted levels. The aggression of the Sentinels and their dedication to pursuing the player is entirely linked to the player's wanted level. As this level increases, the number of Sentinels will increase, and more dangerous Sentinels will also start to appear.
On high security planets, because endangered resources are likely, sentinels will attack on sight.
In Addition, the following will cause sentinels to appear and attack you - even when there are none in sight:
Picking up Gravitino Ball from the ground
Picking up Sac Venom from the ground
Taking a Vortex Cube from a pedestal. Picking up a Vortex Cube from the ground will not alert sentinels if no sentinel witnesses it.
Removing an Albumen Pearl from a shell
Attempting to destroy reinforced Resource depots or steel gates of a Manufacturing Facility