The terms off ball and on ball refer to both offensive and defensive players depending on the context. Off ball means any player not guarding a player with the ball or just a player without the ball. On ball means any player guarding a player with the ball or a player who is currently handling the ball. In the below picture, Players A and B are both on-ball players while Players C and D are off-ball players.
An offensive player who is on the ball or the primary ball handler has a few simple options: shoot, pass, or dribble. Besides this there are more complicated elements including calling plays or creating motion however the basics involve those three basic parts of basketball. On the defensive side, on ball defense requires a lot of attention to keeping the offensive player in front and limiting good offensive opportunities whether shots, drives, or passing lanes when possible. Good on ball defenders can stay in front while also preventing perimeter shots too.
An offensive player who is off the ball has a couple of different options that involve them in the offense. They can cut to the rim, use screens to get open shots, or move around creating opportunities for other players to fill space. Good off ball offensive players are usually good shooters and can create great shooting opportunities for themselves using space and the players around them. On the defensive side, defenders must stay in passing lanes while staying close enough to their primary assignment to prevent good shooting looks. The best off ball defender can cover lots of space on the court while maintaining discipline within the defense as a whole.