The TG-42 (Tesseract Gewehr 1942 or Tesseract Rifle 1942) was the most advanced standard issued primary weapon of the terrorist organization known as HYDRA.
World War 2
In 1942, HYDRA led by Johann Schmidt discovered the Tesseract hidden in a castle located in Tønsberg, Norway. He took the cube back to his primary base in the Alps where scientist Armin Zola harnessed the Tesseract's energy and started designing new weapons; the Tesseract Rifle was one of these weapons.
Schmidt started issuing these weapons to his commandos and eventually ridded them of conventional firearms in their final confrontation with the SSR. After the final confrontation with Captain America, the SSR managed to capture these weapons and placed them in storage for the next 70 years.
After 7 decades of being placed in storage, the American government agency S.H.I.E.L.D took possession of these weapons after the discovery of the Tesseract and they wished to collect anything pretaining to the Tesseract. Later aboard the new Helicarrier, Captain America snuck into a secret cargo hold where he discovered Tesseract Rifles by the thousands.
After discovering phase 2 of S.H.I.E.L.D in order to create weapons, Captain America took one of these and brought it as evidence to confront Colonel Nick Fury on the subject. Later on however after the Tesseract was taken by Thor back to Asgard with Loki in tow, it stayed there.
X-Men: Mutant X & ForestFire
By the year 2013, after the creation of New Genosha, Thor returned to Earth in order to present Mutant X with the Tesseract as a token of friendship between Asgard and New Genosha. Mutant X accepted the Tesseract and vowed to keep it out of the hands of the Humans. They would later use the Tesseract as a primary source of clean and infinite energy.
S.H.I.E.L.D decided that the HYDRA Tesseract weapons should be given to the ones possessing the Tesseract which were the weapons they had aboard the Helicarrier. They brought the weapons to New Genosha and armed many troops with them.
The weapon is known to also be possessed by mutant civilians that have a license to carry one because unlike other weapons, this weapon has the capability of instant death.