I've struggled with the opportunity cost of exercise, too. What I realised, though, was that I didn't really apply that same criteria to other things in my life. For example, I'd happily browse hacker news without worrying about the opportunity cost of that activity. The issue was that I saw one activity (browsing hacker news) as valuable, and one activity (exercise) as not.
I decided I had to first decide whether exercise was valuable to me. If I came to the conclusion that it wasn't, then I could forget about it completely and never worry about it again. I sense that you're still not completely convinced that exercise isn't a valuable activity, so I'd suggest continuing to apply logic to this problem until you know for certain.
My first step was to list out the pros and cons. Cons, it turned out, were just a few: time, a little bit of money, and temporary discomfort. Pros were significantly more: less pain as I age, more mobility as I age, more strength in case I need to lift things or climb over something one day, increased courage that comes with having a stronger body, increased courage from facing my fear of going to the gym, increased discipline, increased persistence, defeating a part of myself that's eaten away at me for too long, etc.
By doing that, I'd decided for myself that exercise was a valuable thing for me to do. I'd encourage you to do the same thing, and see if you come to the same conclusion. Once you find your own reasons for doing something, doing that thing becomes easier. Lifting weights because of some vague idea that it's good for you is a difficult thing to maintain. Lifting weights because it's a personal exercise in courage and discipline, for example, makes it way more likely to stick.
I'd also like to offer a tip on starting to exercise: start small. All my failed attempts at starting a gym routine in the past happened because I tried to make too big of a change too quickly. Instead of starting a whole new diet and exercise routine, I'd recommend finding ONE exercise that you'd like to get better at, and attempting to increase your numbers in that exercise over time. That's all. For me, it was the pullup. For you, it might be the pushup, or the squat, or the overhead press. It just needs to be something that you can increase over time. I started off being able to do just one pullup, and increased that number significantly over the next couple of months (here's another tip for increasing your reps of an exercise: google 'greasing the groove'). The great part of this approach is that the opportunity cost is extremely small — it takes maybe 10 minutes out of every day. So if you do decide that you want to try exercising again, I'd encourage you to forget complicated routines or schedules for now. Start as small as possible with a single activity, and focus on increasing the number over time.