To scan the star upon arrival, point your ship directly at the centre of the star (you might want to reduce speed to idle, or you'll crash into it!) and select the star. You'll see a little spinning-hexagonal "scanning" indicator and hear a chirping tone that gradually rises in pitch. Wait until the scan is completed and you will now see the star's description on the system map and in the bottom left hand corner.
Scanning planets and moons is the same principle, but first, you have to fly up close enough to them before the scanner kicks in. How close do you have to get? It depends. This "scanner radius" depends on the physical size of the object: main sequence stars can be scanned from several thousand Ls away. Gas giants are typically scannable at about 900 Ls. Earth-sized planets are scannable at about 100 Ls. And for tiny moons, neutron stars and black holes, you have to get within 5 Ls to start scanning them.