Offside in football is a rule that regulates when and where a player can receive a pass. To put it simply, it is a prohibition on any player from the attacking team being closer to the opponent's goal than the ball and the second-to-last defender at the moment of the pass. This means you cannot "hang" near the opponent's goal waiting for a convenient moment to score if you are not in line with the defenders.
Imagine if you were trying to take an apple from someone's plate, but your parents told you that you couldn't be closer to the table than your neighbor. This is similar to what the term offside means in football. The rule prohibits "jumping ahead" and forces all players to participate in the game rather than just waiting for a pass near the opponent's goal.
If you compare this to dribbling a ball in basketball, there is also its own "rule of fairness." When you are dribbling the ball, you cannot just carry it in your hands; you need to bounce it off the ground to keep the game fair.