Only Indirectly and Vaguely
While one or more negative levels are often the result of spells (e.g. energy drain, enervation) and supernatural abilities (e.g. a wight's slam attack's energy drain), negative levels are not, in themselves, magical. The spell detect magic has no direct interaction with the presence or absence of negative levels.
But magic auras from spells recently cast do linger, and those auras can be discerned using the spell detect magic.
A magical aura lingers after its original source dissipates (in the case of a spell) or is destroyed (in the case of a magic item). If detect magic is cast and directed at such a location, the spell indicates an aura strength of dim (even weaker than a faint aura). How long the aura lingers at this dim level depends on its original power...
as per this chart:
Original Lingering Aura Spell
Strength Duration Level
Faint 1d6 rounds 3 or less
Moderate 1d6 minutes 4 to 6
Strong 1d6x10 minutes 7 to 9
Overwhelming 1d6 days 10 or more
Thus, even a few minutes after the spell enervation is cast on some poor dude, there remains a lingering moderate aura of necromancy on him that might indicate to whoever discerned the aura and, subsequently, the school of that aura that the spell caused the negative level.
As Zachiel's answer mentions, though, when the character gains 1 or more negative levels it's usually instantaneous and--probably, in itself,--an undetectable event, the effects of which must be discovered by the character through experimentation. That said, I've never heard of a DM who didn't tell the player his character had gained 1 or more negative levels in an effort to keep such an effect mysterious, but, then again, perhaps the bookkeeping involved has never been worth the narrative reward.