Drowsiness is reported by a large share of people who take trazodone, especially in the first days of treatment and at higher, antidepressant-range doses. It happens because trazodone blocks histamine H1 receptors, which is part of how antihistamines like diphenhydramine cause sleepiness too.
For people prescribed trazodone for depression, daytime drowsiness can be a genuine problem, and prescribers sometimes shift most of the daily dose to bedtime to work around it. For the many people prescribed a low dose specifically for sleep, this "side effect" is the intended effect.
Avoid driving or operating machinery until you know how trazodone affects you, and never combine it with alcohol or other sedating substances, which can compound drowsiness unpredictably.