Both can support sleep, but they do different jobs.
Melatonin is more of a body-clock signal. It tells your brain that biological night has arrived. It tends to be most useful when the problem is falling asleep at the right time, such as jet lag, shift-work-related timing problems, or a delayed sleep schedule. More is not necessarily better. Higher doses can increase next-day grogginess, vivid dreams, headache or dizziness.
L-theanine is more of a calming amino acid. It may promote relaxation without acting as a sedative. It can be more appealing when you feel physically tired but your mind won't switch off, particularly when stress or mental tension is interfering with sleep. The evidence for L-theanine and sleep is promising, but it is less established than the evidence for melatonin's effects on circadian timing.
So which is better?
Your main problem
More relevant option
Can't fall asleep at the desired time
Melatonin
Jet lag / disrupted body clock
Melatonin
Racing thoughts or difficulty unwinding
L-theanine
Stress-related restless sleep
L-theanine may help
Frequent waking during the night
Neither is automatically the answer
Long-term insomnia
Look for the underlying cause; CBT-I is generally first-line
One important point: supplements aren't interchangeable with treating insomnia. If sleep problems are persistent, especially with loud snoring/gasping, restless legs, pain, anxiety, medication changes, or significant daytime sleepiness, it's worth investigating the cause rather than simply increasing a sleep supplement.
Melatonin vs. L-Theanine: Which Is Better for Sleep?