Help please

This may sound really stupid to some people but I was thinking about it the other day and now can’t stop. Where does money come from?? Like was the first person on Earth just magically born with money in their pocket or did someone randomly decide to create money and put a price on everything? I don’t know who made it and how it became a work wise thing and one of the most important things in the world. If someone did just randomly decide to invent money why and how did it happen when everyone would of known that it would segregate people like the rich and poor? I’m so confused