You should read a bit about controlling film contrast. You can search around for explanations for the Zone System, but a quick look at the characteristic curves supplied in the Kodak Tri-X technical publication will be illuminating. If you go to page 11 you will see how changing the time in developer changes the slope of the characteristic curve. Overly simplified, changing exposure moves your picture up and down and individual curve while changing developing time/temperature/agitation will change the slope of the curve. There are plenty of good books that can be had for easy to follow explanations.