What you describe is rather common for a certain type of insomnia, called psychophysiologic.
The patient has evidence of conditioned sleep difficulty and/
or heightened arousal in bed as indicated by excessive focus
on, and heightened anxiety about, sleep; difficulty falling
asleep in bed at the desired bedtime or during planned
naps, but no difficulty during other monotonous activities
when not intending to sleep
And more from Therapy in Sleep Medicine:
Insomniacs often report that they fall asleep easily when
watching television or reading in the living room, but become
aroused upon going to bed. In addition to the previously mentioned
tendency of insomniacs to associate bedroom stimuli
with frustration, falling asleep when reading or watching TV
may also result from the fact that doing so keeps the body in a
quiet and relaxed position, and keeps the mind focused away
from frustrating attempts to fall asleep. Support for the habit
of reading or TV in bed is derived from Gallup polls, which
indicate that about one third of all U.S. adults read themselves
to sleep or fall asleep watching television in bed. Watching
television has also been associated with falling asleep more
easily on multiple sleep latency testing (MSLT). Nevertheless,
there is considerable controversy regarding this recommendation,
focused mainly on the success of Bootzin’s rules
when used as a whole. Clinicians may, therefore, first advise
the use of the bed only for sleeping, but if that does not help,
they may suggest a trial of reading or watching TV in bed.
For more on Bootzin's rules see this page for instance.
Unfortunately, not much can be said about 'why'; from the first source:
there are little to no data relating specifically to the etiology and pathophysiology of psychophysiological insomnia.
Having said that, it's also known from studies on night-shift workers that 20-mins to 1-hour nap improves alertness (cf. the Therapy book, which cites several studies e.g.), so it's rather common/expected that if you fall asleep at the TV you'll have a harder time falling asleep later, even if you don't have insomnia. The distinction is one of degree/intensity, I suppose.