It's highly recommended to play .hack//fragment with a video game controller of some kind that you can connect to your PC. Your options are pretty much open to anything. But as an example, the PCSX2 emulator can accept input from the following controllers.
Sony PlayStation Controllers
PlayStation 2 "DualShock 2", will require a PS2-to-USB adapter to use on PC
PlayStation 3 "Sixaxis" and "DualShock 3", with USB Type-A to Mini-B cable
PlayStation 4 "DualShock 4", with USB Type-A to Micro USB cable
PlayStation 4 "DualSense", with USB Type-C cable
You can also get these controllers running with Bluetooth starting with the PS3-PS5 controllers. However unless your laptop or PC has a receiver internally, you will need a generic Bluetooth receiver. Some additional drivers may be required per controller. For the PS2 controller, a special PS2-to-USB cable adapter is needed.
Microsoft Xbox Controllers
Xbox 360 wired, with built in USB connector
Xbox 360 wireless, through special USB wireless dongle
Xbox One wireless, with USB Type-A to Micro USB cable or wireless dongle
Xbox One model 1708, with any Bluetooth receiver
Xbox Series, with USB Type-A to USB Type-C cable or Bluetooth receiver
Some of these controllers can use regular Bluetooth, but Microsoft decided on some models you'd need a proprietary Bluetooth receiver dongle. Most notably the Xbox 360 wireless controller and the first generation of Xbox One controllers. You'll notice towards the top of the front face of the controller near the Xbox logo, the later models are completely smooth to the edge whereas the earlier Xbox One controllers had a slight ridge. Also if you remove the back of the battery compartment, you'll see the words "Model 1708" if it's compatible with any Bluetooth receiver.
For the Xbox 360
For the Xbox One
But not just limited to Sony and Microsoft, you can actually use Nintendo products as well.
Nintendo Switch Joy-Cons, wireless only
Nintendo Switch Pro Controller, wireless only
The Nintendo Switch Joy-Con's could also be used, however they do not come with any charging cable nor area there any direct wire adapters you can use. They are purely wireless therefore you can use any regular Bluetooth receiver to connect with them. However you will need additional drivers for them to work. Davidobot's BetteryJoy drivers from Github are the best at connecting Joy-Con's to Bluetooth.
Of course any number of USB wired third-party Nintendo Switch controllers will also work without drivers needed.
Now that you know what you can use, let's talk how to use them.
Setup for PCSX2 1.4 and 1.6
Go to Config then Controllers and then Plugin Settings...
The upper left you will see Keyboard API as Windows messaging, this is fine. But you will want to make certain that under Game Device API's that DirectInput are enabled XInput. Then click on the tab at the top that says Pad 1.
On this screen, you will need to manually assign each button to a PS2 button. Click on the Quick Setup at the upper right and it will start saying Enter an Input for... The word it says, whatever button you press on your controller will be that PS2 button it is saying.