It's probably safe to leave food in takeout containers. But the smart play is to wrap them in airtight packaging or seal them in storage containers. These practices help keep bacteria out.
Here's another safety tip: Don't let prepared food sit out — in your car or on the counter — for more than two hours. The reason is that bacteria can grow rapidly in food that's unrefrigerated. And some bacteria make a poison or toxin that can make you ill, hence the term "food poisoning."
If you don't plan on eating takeout food immediately, you have two choices. You can keep it hot in a preheated oven at an internal temperature of 140 F (60 C) or higher. Or you can divide food into smaller portions, place in shallow contains and refrigerate. Plan to reheat the food to a temperature of 165 F (74 C) just before serving.