There can be various factors as to why it may of happened:
1. Lack of knowledge against the character
I say this because sometimes you'll come across a character you have no idea how to handle. For example, I hardly find any Palutenas, Pikachus, or Lucarios online and they give me the hardest trouble due to the lack of encountering them. Without knowing my options or knowing when I can punish them exactly can have a vast affect on the outcome. Sometimes it takes more than skill.
Knowledge is your friend.
2. Match Ups can play a part in it
This is also a "Knowledge is your friend" kind of thing; however sometimes knowledge won't help you much if it's a super bad match up. For example, I'm down right doomed if I'm playing King Dedede against a Samus or Robin. My Gordos would mean nothing and I'd have an extremely hard time approaching or doing anything due to how these two characters play out. I'd have to be immensely careful.
3. It could be due to character potential
I don't really know how many combos Samus can pull off, but I know Mario is a pain with everything he can do (especially his Up Tilt). Not to mention I believe Mario has safer attacks than Samus does but I can't say for sure. Mario is certainly higher than Samus Tier-wise.
4. Sometimes you just play very well, and sometimes you don't
There are times where you can face the same opponent and win three matches by two stocking them or getting a really good KO, and the next they can totally flip the script on you. It happens. Reading and learning your opponents behaviors can play a part in this, but hey, sometimes you just do awful or screw up. I've had moments where I was wiping the floor then suddenly I began getting destroyed.
In short, there can be many reasons why you did better with Mario instead of Samus.
I can do better against someone with King Dedede, but then get destroyed by someone else when using him. It's why it's good to have different mains or have someone in your pockets you can use to some extent. Sometimes one character just isn't the answer.