You can't connect the joystick directly to the PI's GPIOs, you need an ADC chip in-between.
Take a look at https://grantwinney.com/connecting-an-analog-joystick-to-the-raspberry-pi-and-using-it-with-an-rgb-led-to-simulate-a-color-wheel/, which uses an MCP 3008 to connect a joystick to the PI.