Imagine teaching a child to throw a basketball into a hoop.
The first throw misses. The second throw misses too. The third throw is closer. Eventually, the ball goes in.
The child learns by making a guess, seeing the mistake, correcting their aim, and trying again. Machine learning works exactly the same way.