I just assume God gave them some kind of instructions about all that.

Genesis 1:
28 God blessed them and said to them, "Be fruitful and increase in number; fill the earth and subdue it. Rule over the fish of the sea and the birds of the air and over every living creature that moves on the ground."
I suppose he elaborated a bit, lol. Or maybe just created them with the knowledge seeing as they were created as adults already, not babies iykwim?