One of the main reasons a car battery would drain when the car is off, is due to a parasitic draw. A parasitic draw is when there is an electrical current flowing through a circuit, even when that circuit should be completely off. This can happen for a number of reasons, but one of the most common is if there's a short circuit somewhere in the electrical system. If there's a short circuit, it means that electricity is able to flow through the system even when it shouldn't be able to. This can cause all sorts of problems, including draining your car battery.
Another reason your car battery might drain when the car is off is if you have any accessories plugged into your cigarette lighter or power outlet. Even if these accessories are turned off, they can still draw power from the battery. So if you're not using them, it's best to unplug them.
Finally, another possible reason for a drained battery is simply old age. Batteries don't last forever, and eventually they'll just stop holding a charge as well as they used to. If your car battery is more than 3-4 years old, it might be time to start thinking about replacing it