Odin is Thor's father and ruler of Asgard. Obviously you've got to be a strong guy to be the ruler of Asgard. It doesn't help that he absorbed his slain brother's power after they were killed by Surtur. That's about the time that Odin threw Surtur into the core of the Earth. That's just one of the many enemies that Odin has fought. At one point he built the Destroyer just so he could fight off the Celestials, who are extremely powerful.
Odin has had his own run in with Thanos as well. He beat him, but that's not the end of the debate there. Considering that Thanos has gotten stronger since there fight by using enhancements, it's possible that it isn't always true that Odin could beat Thanos. Also Thanos could just snap his fingers with the Infinity Gauntlet and hope that Odin was one of the guys who disappeared.