Not sure how easy it'll be a to book a cabin on a freight ship since COVID shook up the maritime industry, but it used to be reasonably easy to do online. You need to book a couple months in advance, get all the vaccinations and visas required for every single port the boat is passing through (even when you cannot disembark), and be prepared to pay much, much more than you would to fly between the same points. But it is a totally awesome experience if you have the money saved up.
You cannot just show up at a port and hop on a freighter the next day. That might have been possible a half century ago, but it is not possible now. The industry is very heavily regulated, by the shipping companies, the unions and customs/coast guard/etc.
Another alternative is trying to find a spot on a private yacht that's doing an ocean crossing. There are lots of websites that try match you with a captain, they're kinda like dating apps. Check out the threads on StP about it. I'm not sure how much luck you'll have finding a longer ride without any sea miles under your belt, but you can try.
My recommendation would be to go east through Europe toward Asia instead of starting in the westerly direction. Main reason because traveling in Europe will be much easier, and it's nice to have a soft start. More people in Europe know English. The culture and food will be more familiar to you. Plus it's densely populated, so you are more likely to meet fellow travelers and/or people who might be able to give you a ride along the way.
Alternatively you could head south first, but that could leave you stranded at the bottom of South America because I think the usual oversea routes start from Panama (going west) or Caribbean (going east). Of course you could go down and come back up, or just suck it up and get a flight because that is going to be way cheaper and easier than taking a boat in almost all situations. It's obnoxious that it's cheaper to travel in an unsustainable way than a sustainable way, but that's the sad reality of the world we live in.