After cooking green bean casserole can you leave it at room temperature for few hours?

No, you should not leave green bean casserole or any other perishable food at room temperature for more than two hours.

Bacteria can grow and multiply rapidly in the "danger zone" between 40°F and 140°F, which includes room temperature.

Leaving cooked green bean casserole at room temperature for a few hours increases the risk of foodborne illness.