dnd 5e – What counts as a sorcerer spell for the purposes of wild magic surge?

Sorcerer spells are spells you know from being a sorcerer

From the Multiclass Spellcasting rules:

You determine what spells you know and can prepare for each class individually, as if you were a single-classed member of that class…Each spell you know and prepare is associated with one of your classes, and you use the spellcasting ability of that class when you cast the spell.

Any spell on the sorcerer spell list that you know from being a sorcerer is a sorcerer spell, if you cast it as a sorcerer.

If you are multiclassed and have access to a spell from that class that is also on the sorcerer spell list, you still can’t cast it as a sorcerer unless you know it through being a sorcerer (“Each spell you know and prepare is associated with one of your classes”).

If you know the spell from two different classes simultaneously, you may choose to cast it as a sorcerer at the time of casting (“you use the spellcasting ability of that class when you cast the spell”).

If you know a spell through a feat (such as Magic Initiate), it would also count as a sorcerer spell if you chose it as a sorcerer spell / off the sorcerer spell list.

As to magic items, most magic items that give spells are granting you the ability to cast the spell, so it definitely counts as a spell you are casting if the item description says you are.

“Activating an Item; Spells” (DMG 141); emphasis mine

Some magic items allow the user to cast a spell from the item…A magic item, such as certain staffs, may require you to use your own spellcasting ability when you
cast a spell from the item.
If you have more than one spellcasting ability, you choose which one to use with the item.

However, while you are certainly the one casting the spell, is it a sorcerer spell? It is, if it is a spell you know from being a sorcerer, as explained above.