When driving a car, you need to drive cautiously and anticipate common things that could go wrong so that you do stay in control. Driving cautiously means that you don't follow too close to other cars, trucks, or motorcycles. When a car in front of you stops, there needs to be enough room for you to stop and not hit them. Whether you're on a freeway, a city street, or even stopped at a stoplight, that's true.
"Tailgating" is the term applied when you are following too closely in your car, truck, or motorcycle, and you create the risk that if the car in front of you stops suddenly, you'll run into them. There needs to be enough room between you and the vehicle in front of you that you stay in control.
That's why truck drivers leave so much space in front of them on the highway - they know their heavy trucks take longer to come to a full stop, and they've got a duty to be able to stop without hitting anyone in front of them. Generally, if the vehicle in front of you stops suddenly, and you can't avoid them by swerving or standing on your brakes if you hit them, that means you were tailgating.