Before you can swap Pokémon with your friends, you'll have to make progress in the game to unlock the ability. The trading post is only located in Jubilife Village, and once you get there you'll still have to complete some quests to unlock the post.
Once you do, you can talk to Simona on the northwest side of the village, and tell her, "I want to trade Pokémon."
Simona will then ask you if you want to trade with "someone nearby" or "someone far away." If you're planning to trade locally (with someone in your immediate vicinity), then you can select "someone nearby." To trade with one of your friends through the internet, you'll have to select "someone far away." This will require a Nintendo Online subscription to work.
You and your friend will have to input the same code to open the trading screen, so be sure to select a code before you begin.
Unfortunately, there is not a way to trade with random trainers in Legends: Arceus, at this time. You can try to enter random numbers in the trade screen if you're looking to swap with someone new, though there's no guarantee there will be someone else using the same numbers at that time.