I was in a somewhat similar circumstance via a very large inheritance. I'll start from the emotional side of things before moving into the financial side.

Emotionally, I was very shocked as I did not see this situation coming. Like you, I was also scared about making stupid choices. You probably had some idea that your shares had upside potential, but the money I received dropped into my lap with no warning and was approximately the same amount as what you received. My immediate advice is...do nothing. Wait for the shock to wear off and for you to acclimate to the situation. Don't tell anyone, don't run out and buy things, don't move assets; just keep on with your day to day life until you are ready to proceed.

Based on the fact that you are here asking these questions at all, my assumption is that the money likely will not change you much as a person. I still have the same friends and relationships that I had before I received my funds; my values are still the same; I'm still the same person. Most people who interact with me have no idea that I am as wealthy as I am. Who you were before you receive your money will largely be who you are now that you have received your money.

Economically, my general spending patterns have remained largely the same. The main thing I've found is that money is less about buying stuff (which I think is how most people without money view money) and more about buying time, cutting through bullshit, buying access, and creating opportunity. I feel much more free to spend money on education, conferences, vacations with my loved ones and friends, once in a lifetime opportunities etc. I'd encourage you to think about your funds this way too depending on your circumstances as I think it brings a lot more happiness than buying tons of shit you don't really need, a big house, cars etc. I'm not saying you need to live a frugal life, but I think excessive consumption gets boring quickly. You have "fuck you" money which gives you enormous power over how you craft your career and your life. Think hard about what you want to do. I still work but I've had the flexibility to explore career arcs that I would not have otherwise been able to with almost no risk.

I would be very careful about telling other people about your situation because it might alter your relationships. I think it's fine to say you are doing well at work, but definitely do not tell people you have 5 million dollars. You don't want people feeling jealous, resentful, etc. It can be helpful to have other wealthy people to talk to about issues and feelings. If other people you trust have money, feel free to talk to them. Alternatively, there are certain places that generally cater to the wealthy (eg social or country clubs, business associations, etc) where you can meet some people who will be in similar circumstances and will be happy to talk.

Moving on to what to do. I don't know how old you are or what your future earning potential is (meaning is there another chance for a payout this size), but in general what you do with five million dollars will not be dramatically different than what you do with a few hundred thousand dollars. I would seek out a wealth management group for a consultation. Make sure this entity is a fiduciary and are legally obligated to act in your best interest.

If you don't think you have more big payouts coming your way, then your strategy will likely focus on wealth preservation. If you think you can make more money you can be more aggressive. Either way, you will probably construct a well balanced portfolio of low cost index funds. Depending on your risk and needs, you could devote a portion of your portfolio to more exotic things like hedge funds or private equity or whatever. See what they say.

You have generational wealth, so if you have kids or are thinking about kids, you need to focus on general tax minimization and avoiding inheritance taxes (within the law of course). There are a variety of strategies that can be employed here, and a good wealth management firm can help you with that. You also need to think about how you will teach your kids about money given your new situation so that they have the right values.