Offside in football is a rule that regulates when and where a player can receive a pass. Simply put, it is a prohibition against 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 the pass is made. This means you cannot "hang around" 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 cannot be closer to the table than your neighbor. This is similar to what the term offside in football means. 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 we 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.