Ways plants absorb carbon dioxide:
Stomata: Tiny pores present mainly on the underside of leaves. They open during the day to allow CO$_2$ to diffuse into leaf cells for photosynthesis.
Lenticels: Small openings in woody stems through which gases like carbon dioxide and oxygen can exchange.
Reason for opening and closing of stomata:
Guard cells control the stomatal opening. When guard cells absorb water, they swell and the pore opens (turgid condition).
When guard cells lose water, they become flaccid and the pore closes.
This process helps balance gas exchange and water loss.