A spell is called a spell and listed in a spell list
Something that is a spell will be listed in such a way that indicates it is a spell.
Or, as Jeremy Crawford says here:
Want to know what spells look like? See "Spells" (PH, 211–89). Nothing else is a spell unless it is presented as a spell or called one.
If you find something and are unsure if it is a spell, first see if there is anything in the description that says it is a spell. If it says that you "cast" it, or that it has a "spell level", or if it is listed under the Spellcasting, Innate Spellcasting or Psionic Spellcasting header in a stat block then it is a spell.1
If there is nothing indicating it is a spell there, look up the name of the ability in question in the resources below. If it's not listed there, it's not a spell. If it is listed there, it is.
Spell lists can be found in the books or online
All spells currently released are listed in the Player's Handbook (Chapter 11), Xanathar's Guide to Everything (Chapter 3), or Elemental Evil Player's Companion (Chapter 2). Each of these chapters is simply called "Spells". The Sword Coast Adventurer's Guide also contains 4 cantrips for sorcerers, warlocks, and wizards; they are listed at the end of the list of classes on p. 142-143.
You can find all the spells compiled into one list on DnDBeyond here.
"Spell-like" abilities are not spells
Some abilities look very similar to spells, but if they aren't in a spell list, they aren't spells.
The beholder has the ability Eye Rays with different effects. One of which is:
Charm Ray. The targeted creature must success on a DC 16 Wisdom saving throw or be charmed by the beholder for 1 hour or until the beholder harms the creature.
"Charm Ray" is not found in any of the spell lists nor does anything in the description say it is a spell and thus it is not a spell. It also does not allow for the casting of spells. Thus, we must conclude that "Charm Ray" is not a spell. As such, anything that affects spells will not affect it.
Abilities that allow the casting/effects of spells are not spells (but the spells resulting from them are)
Other abilities let you cast spells. These abilities are not spells in and of themselves, they just allow you to cast spells.
For example, let's look at this Way of the Four Elements Monk ability:
Flames of the Phoenix (11th Level Required). You can spend 4 ki points to cast fireball.
We can determine that the ability flames of the phoenix is not itself a spell by looking up its name in the list of spells. It isn't there therefore it is not a spell. However, the ability description has several clues that tell you that it does involve the casting of the spell. Firstly, it says "cast [name]". Since casting is something that is only done with spells this is going to be a spell. And if you look up fireball in the list of spells you will find it there. Thus, fireball is a spell cast from the ability Flames of the Phoenix which is not a spell. The fireball will be affected by anything an applicable fireball cast by any other method would be.
The same thing applies to something like a potion of heroism which says:
For 1 hour after drinking it, you gain 10 temporary hit points that last for 1 hour. For the same duration, you are under the effect of the bless spell (no concentration required).
The potion is not considered a spell (there is no spell called "potion of heroism" in the spell lists) but it has a spell effect in it. So, you are considered to be under the effects of that spell for all purposes including dispel magic (see this Q&A for more on that).
Something like the potion of water breathing (though also not a spell itself for the same reasons) does not result in a spell being created because nowhere in the description is a spell name listed.
Thanks @Ruse for giving me feedback and advice in putting this together.
1 - One thing to note is that the phrase "spell slot" is not indicative of being a spell. There are many abilities that use spell slots that are not spells (in addition to spells that don't use a spell slot at all). Crawford explicitly says this in this tweet about Divine smite, for example:
Divine smite is not a spell, yet it is fueled by spell slots. Because it is not a spell, it is not affected by things like Rage that prevent spellcasting.
Thus, even if something uses a spell slot or says "spell slot", that is not enough to determine if it is a spell. In this case, simply look up the name of the ability and see if it is in a spell list. That will tell you for sure.