Is it okay? Well, it's likely legal (if the person is long dead anyway, and probably even if they're alive). You can do it. You might even get it published.
For a large number of readers, the answer is that, no, it's not okay. Though what percentage of that really depends on the details. Fictionalization of historic events is extremely common and things get really bungled.
Take the excellent book Hidden Figures, about black women employed by NASA as mathematicians and engineers as the first space flights were planned then executed. The author interviewed the actual women involved (those still alive) and many others who lived through that time period.
The book is nonfiction and, as far as I know, pretty accurate. Then it was made into a movie. The movie is wonderful and worth watching but, for those of us who read the book, it involves a lot of handwaving. They took characters that worked in different decades and made them all similarly aged friends in the same year. They completely changed character arcs to aid in the drama. For example, one movie character fought for years to become a supervisor (the white woman in charge refused to allow her) then finally got her promotion in the late 60's at the end of the movie. The real person with that character's name had been a supervisor starting in the 40's.
This sort of distortion is extremely common in movies, whether based on books or on historical research. Sometimes involving huge changes like putting together events that actually were a couple hundred years apart. It's not as common in books, but it happens.
So is it "okay" for you to do this? Well, yes and no. The question is, what can you get away with and who are you pissing off? If you add in scandal or things that might be libelous were the people still alive, you could be in trouble, even if legally you're in the clear. I mean, don't write a novel about Princess Di's early life as a pole dancer.
But a work about William Shakespeare in a relationship (that never really happened) with a woman who disguises herself as a man so she can take female roles in his plays only ever played by men (also never happened). YAWN Been there, done that.
I am one of those readers that hates inaccuracies like that but I still loved those two movies. I'm stricter about the books but often read and enjoy them anyway. It depends how—and why—it's done.
Make your choices meaningful. Don't change things because you're too lazy to research. Change them because they work better that way for your story.