Fanfiction often takes creative liberties. It could be that there is a cross - over event that changes the nature of Thor's hammer's worthiness test. Maybe a powerful magical entity in the Harry Potter universe meddles with the hammer's magic. Harry Potter has shown great moral fiber throughout his adventures. His ability to love deeply, his sense of justice, and his unwavering determination against evil could be seen as the 'worthiness' factor by the hammer's magic, allowing him to lift it.
Vision cannot lift Thor's hammer in the comics. The hammer's magic is very selective, and Vision doesn't possess the qualities necessary to overcome its enchantment and lift it.
In the comics, Vision was not shown to lift Thor's hammer. The ability to lift the hammer is usually reserved for characters with specific qualities and story arcs that didn't apply to Vision.
In some fanfictions, it could be because Peter has a pure heart. Just like in the MCU, only those worthy can lift Mjolnir. Peter might have proven his selflessness and heroism in a particular situation, which made him worthy enough to lift Thor's hammer.
Occasionally, Captain America can lift Thor's hammer. It depends on the specific comic and the circumstances that deem him worthy. Sometimes it's a plot device to showcase his character growth or moral integrity.