BFS guarantees the first path to a node is the shortest. Here is why. Suppose the shortest path to node has length . BFS processes nodes at distance first, then distance , then distance , then distance . When BFS reaches distance , it visits . All nodes at distance , , and are already visited.
So the path to must go through nodes at those distances. Since BFS processes nodes in order of increasing distance, the first time you reach must be via the shortest path. There is no shorter path hiding somewhere else.