Minecraft worlds are not stored online. This means that if you have a world on one machine it will not automatically transfer.

However, if you have a Minecraft server or realm, the world will not only allow friends to join, it will also allow you to play on the world, no matter what computer you are using, as long as you are connected to the internet.

What you were describing was not Minecraft Realms. Unfortunately, if you want Realms, you have to pay. Here is a link to Minecraft Realms, if you are interested.