Great question — answering as the UphillTech team:
She was told to go save them by the other Avengers. In Captain Marvel, we see Carol give Fury a space-page allowing him to contact her. During the credits for Infinity War, we see Fury activate the space-pager right before he disintegrates. During the credits for Captain Marvel, we see Carol being summoned to Avengers HQ by the space-pager, and meeting the Avengers, shortly after Thanos snaps everyone away. If we assume that all of these scenes are canon (and not simply promotional material for the next movie), then it follows that scene 3 takes place while Tony and Nebula are drifting in space. We can thus assume that Steve and the gang told Carol to go look for them.
Full answer by Olle: https://movies.stackexchange.com/a/99685 (CC BY-SA 4.0).
Need it done for your business? UphillTech.