a final sanity check that you didn’t walk down the wrong corridor. Some gates have two ‘legs’. Or you could have snuck on or something.
On larger planes, to see what aisle you should walk down. Otherwise people will randomly choose one and spend time climbing over seats and getting in the way. They’re on a time schedule, and want you boarded as fast as possible.
To greet you – if you’re a club member or similar.
Some may have extra ‘cues’ on that they need to be aware of – you might require assistance.
In addition to which aisle, which direction – sometimes you board behind 1st class, so they need to direct you that way.