Are the guns on a fighter jet fixed or can they be aimed?
They are fixed, and many attempts were made over the years to have an aiming capability - and all failed. That should tell you something.

The earliest aereal combats used indeed handguns which were pointed at the adversary by the pilot. But it soon became obvious that only the rapid fire of a machine-gun will give the pilot a realistic chance of hitting a fast-moving target.

During the Italo-Turkish war of 1911 and 1912, the Italians used aircraft in war for the first time. Since the Ottoman Empire had no air force yet, the Turks engaged European aviators who flew their own aircraft, taking a handgun along to shoot at the Italians.

The same was tried in the opening months of WW I, but it soon became obvious that only a machine gun was effective. Before gun synchronisation was invented, pusher designs were fielded, some of which carried a dedicated gunner in a seat ahead of the cockpit.



Vickers F.B.5 "Gun Bus" (picture source)

Of course, the much smaller and nimbler Fokker single-seaters with gun synchronisation made such designs soon obsolete.

When Great Britain prepared for WW II, the firing power of bomber turrets impressed the Generals so much that they ordered several dedicated fighters with a gun turret mounted right aft of the cockpit. The resulting Bouton-Paul Defiant was again too slow and easily outmanoeuvred by the single-seaters, and the Blackburn Roc and the Hawker Hotspur were even worse. The Defiant's only successful role was as an early night fighter; when attacked by day it could only join others in a Lufbery circle to defend against being shot down itself.



Bouton-Paul Defiant F. Mk.I (picture source). Note the retractable belly-mounted antenna masts which gave the gunner a free field of fire in the upper hemisphere.

Another attempt was made by the MiG design bureau in the 1950s. In a dogfight the pursuer needs to get inside the circle of its opponent in order to score a hit with a fixed machine gun. The Russians thought: Why not pivot the gun into the circle, so the pursuer can fly the same circle as its opponent and still shoot at it? A MiG-17 was modified accordingly, but flight testing soon revealed that the recoil from the machine gun would push the nose of the fighter down and outside of the circle when the gun was not aligned with the longitudinal axis of the fighter, so this idea was dropped very soon.

Now I need to mention that rarely are the guns completely aligned with the longitudinal axis; instead, they point slightly up to compensate for the ballistic bullet drop at the expected distance of the target. Also, wing-mounted guns point slightly inward, again to ensure the bullet path is straight ahead when it catches up with the target, a procedure called gun harmonisation. This also means that interceptors will have their guns pointing up slightly more than those of air-supremacy fighters. One particular case involved the MiG-15: Being designed to fight large B-29 formations, the guns were badly aligned for fighting the F-86 Sabre during the Korea War. The MiG-15 armament consisted of two 23mm guns and one 37mm gun with very different ballistics. In order to ensure that the path of all bullets would meet at the right distance for fighting bombers, the 23mm guns pointed more up, and when used against the much smaller F-86, the Russian and Chinese pilots opened fire at a shorter distance so that the 23mm bullets would fly over the target while the 37mm bullets went below it. This was a major reason for the poor kill ratio of the MiG-15 vs. the F-86 despite the MiG's better performance.



Gun harmonisation on a jacked-up P-47 (picture source)

Modern high-off-boresight missiles with helmet-mounted cueing (or sight-controlled missile targeting) have turned that longtime dream of shooting at what the pilot is looking into reality, and the gun is carried largely as a low-priority weapon of last resort.