A balk occurs when a pitcher makes an illegal motion on the mound that the umpire deems to be deceitful to the runner(s).
Exactly what constitutes a balk is summed up in section 8 of the MLB rules, which describes a legal pitching delivery.
Section 8 PDF.
I would describe a balk as faking a pitch to draw the runner off base and attempt a pick-off. Note that the actual balk rules (standard secondary school rules) are more complicated than that. For example, it is also a balk to fake a pick-off and then throw the pitch. The exact opposite of the more common form. Which is why they talk about illegal motion and deceit.
I'll step back and explain some baseball on the theory that people who don't know what a balk is may not know how baserunning works. This may or may not be known to the asker already. Anyone who is confident that they understand how baserunning, particularly stolen bases, works may skip this. But I would like to get to a base understanding.
When a runner is on base (first, second, or third), the runner may stop touching the base and take a "lead" on running to the next base. A pitcher may throw to the current or next base to "pick off" the runner. If the runner is "tagged" (touched by someone holding the ball) while not touching the base, the runner is out.
It is not uncommon for a runner to start in motion as the pitcher is throwing the pitch. This has some risks.
- If the runner starts too soon, the pitcher can pick off the runner rather than pitch.
- If the batter hits the ball and a fielder catches it on the fly (not on a bounce), the batter is out and the runner needs to return to the original base. If a defensive player tags either the base or the runner before the runner returns to the base, the runner is out as well.
- If the batter does not make contact with the ball, the catcher may throw the ball to try to catch the runner off base. If the runner is tagged while off base, the runner is out. This is called "caught stealing".
The advantage of going in motion early is that it allows the runner to go farther if the batter hits the ball such that it is fielded after a bounce. For example, a runner might be able to score from second base on a single (the hitter is only able to reach first base), because the runner doesn't have to drop the bat, start in motion, and begins with a lead. And of course, a "stolen base" is when the hitter does not make contact and the defensive team can't tag the runner before the runner reaches the next base. So two ways early motion may help the baserunner.
If pitchers could balk legally, then they should balk whenever there is a baserunner. So before every pitch, they should fake a pick-off move until the runner is moving back to the base. Then, while the runner is moving back to the base, they should throw the pitch. Apparently the people who were setting the rules for baseball in 1898 found games played that way to be boring (or possibly ungentlemanly, as John Bollinger suggests). So they made the balk rule against such behavior.
Over time, the balk rule has evolved into its modern form which prescribes how a pitcher may pitch or attempt to pick off a runner. An observant runner may rely on certain motions indicating the start of the pitch and start in motion without worrying about the pitcher attempting a pick-off.
An alternative would be to take away the pitcher's ability to pick off runners. But in that case, the runner could just move almost to the next base. Which would increase the risks of a line out or fly ball but otherwise overwhelmingly favor the offensive team.
You might suggest that an alternative would be to require the runner to stay on the base rather than take a lead (or within a fixed distance). Then there would be no pick-off move and no need for a balk rule. But enforcing that would have been annoying, particularly before instant replay. Coaches/pitchers would be constantly complaining about runners who started running too early and it would be hard for the runners to know exactly when they could leave the base. Basically it would tend to lead to a lot of rules lawyering, which most people don't find fun.
By contrast, a balk happens before the play starts and is dependent only on the behavior of the pitcher. And of course at that time, everyone would be looking at the pitcher to see when play starts. So it's easier to enforce rules on the pitcher.
As stands, the possibility of a pick-off or a stolen base adds excitement to the game. Balk rules are a necessary evil for that excitement.