A pulley is really a kind of wheel, just as a screw is a kind of inclined plane. But pulleys are so important that people give them their own category. A pulley is a wheel with two raised edges. The raised edges are so that a rope or a string will run along the wheel without coming off. We also call a pulley a block and tackle.
Because there are no wheels in nature, there are also no pulleys. Possibly Archimedes invented pulleys in ancient Sicily, about 250 BC. (But Archimedes gets credit for a lot of things that earlier people invented, just because we don’t know the names of earlier inventors. So maybe not.) Anyway somebody invented pulleys around that time.
As with a screw, you can use a pulley in several different ways. You can use a pulley to make it easier to pull a rope, or to change the direction of a force. Or a pulley can get you more mechanical advantage to lift something heavier than you can lift by yourself.
Khan Academy explains how to calculate mechanical advantage for moveable pulleys
With a fixed pulley, you attach a pulley to a hook or a wall. The pulley doesn’t move. That’s like the clothesline pulley in the picture here. A fixed pulley doesn’t give you any mechanical advantage, but it changes the direction of the force. For instance, you can pull down in order to lift something up, or you can pull the upper clothesline toward you in order to move the lower clothesline away from you.
With a movable pulley, you do have a mechanical advantage. You can pull with less force for a longer distance to get the same work done. You’re using the pulleys to make the rope wind around longer, so you have a longer distance to pull, and need less force. This lets you lift things that would be too heavy for you without a pulley.