Prepositions are very unpredictable when talking about concepts, and you will need to memorise when to use them. This is because 'in', 'at' and 'on' really describe physical positions, so they can be a bit weird when they're used with abstract concepts.
When it comes to physical position, it's usually very simple to tell which one to use.
-'At' is just a general word describe something's location.
-'In' is used to describe when something is inside a 2D or 3D space. When talking about physical position, it can usually be replaced with 'inside'. It's the opposite of 'outside'.
-Something is on something else when it is touching the outside surface (usually the top) of it.
Ex.
Grass grows on the ground.
Ants live in the ground.
Clocks hang on walls.
Termites live in walls.
To be on a planet is to be standing on it.
To be in a planet is to be deep underground.
People sit in cars.
Birds sit on cars.
It's much natural to say 'in' or 'on', when they apply instead of 'at'.