Is tailgating illegal?

Yes, depending on the local traffic rules a certain distance must always be maintained between you and the car in front of you.