Another way could be through a potion gone wrong. In the wizarding world, potions can have all sorts of strange effects. If Draco was trying to brew a potion for some other purpose, like trying to gain an advantage in a competition or something, and made a mistake in the ingredients or the brewing process, it could result in him being transformed into Hermione. This would force him to experience life from her perspective, which could be a huge character - development opportunity for him.
In the Hogwarts hierarchy, things would change. Hermione is often seen as a bit of an outcast by some Slytherins because she's a Gryffindor. Draco, now in her body, would face a different kind of discrimination or at least a lot of strange looks from his own housemates. He would also have to deal with Hermione's reputation among the teachers. Some teachers might expect the same level of knowledge and participation from 'Hermione' (who is actually Draco), and he would struggle to meet those expectations.
It could also be a result of a magical bargain or curse gone wrong for the Malfoys. Suppose there was a powerful dark magic object in the manor that got out of control. Hermione, with her vast knowledge of magic, manages to contain it. In the process, she ends up being the rightful owner according to some ancient magic laws. This would make for an interesting plot twist in the fanfiction.
In such a fanfiction, there could be a lot of initial shock and confusion. Draco, coming from a family with a history of prejudice against Muggle - borns like Hermione, might struggle to accept the situation at first. His son, on the other hand, might be a blend of both their personalities. Maybe the son has Draco's sharp wit but Hermione's kind heart. There could be a story arc where Draco has to come to terms with his past actions and beliefs in order to build a relationship with his son.
One possible fanfiction scenario could be that Draco and Hermione are forced to work together on a school project in Hogwarts. At first, they are at odds due to their different houses and backgrounds. But as they dig deeper into the project, they start to see each other's intelligence and determination. Draco realizes that Hermione is not just a 'Mudblood' but a brilliant witch, and Hermione sees that Draco has more to him than just his Slytherin arrogance.
One way could be by having Draco find inspiration in King Arthur's code of chivalry. He might strive to be more noble in his actions, like Arthur. For example, he could start treating those he previously looked down on with more respect.
In some fanfictions, Hermione might find out she is a Malfoy due to a spell gone wrong. For example, a spell that was meant to reveal family lineages got mixed up and suddenly she has a connection to the Malfoy family in the magical world created by the fanfiction writer. It could also be a result of a hidden prophecy that links her to the Malfoys in an unexpected way.
It could start with an accidental encounter in a less - traveled part of Hogwarts. Maybe they both discover a hidden room or a secret passage. In that moment of shared discovery, they put aside their differences. As they start to explore the mystery together, they begin to understand and appreciate each other. Hermione might find Draco's sense of adventure (once he steps out of his pure - blood supremacist mindset) appealing, and Draco could be impressed by Hermione's vast knowledge.
One possible motive could be to gain an advantage over Harry Potter. Hermione is Harry's closest friend and a very intelligent witch. By kidnapping her, Draco might think he can use her as a bargaining chip to make Harry do something or to get information from her that could be useful to the Death Eaters. Another reason could be jealousy. Draco has always been in competition with the Gryffindors, and Hermione's intelligence and skills might make him envious to the point of doing something drastic like kidnapping.
A possible fanfiction plot could be that Draco, now a girl, discovers new magical abilities that were suppressed in his male form. These powers could be related to a more intuitive connection with magic, something that is often associated with femininity in the wizarding world. This newfound power could put her in a position where she has to choose between using it for the benefit of Slytherin or for the greater good of Hogwarts, creating a moral dilemma for her character.
Perhaps they are there to rescue someone. Hermione might come up with a clever plan involving potions and charms to get past the manor's defenses. Ron, with his loyalty and determination, would be right by her side, ready to take on any danger that comes their way.