I think several different pieces of software are being mixed up here.
H.264 - a.k.a AVC a.k.a. MPEG-4 (part 10) is a commercially licensed software product. It has many patents for which use must be licensed by a company called MPEG LA. You must pay to use it.
x264 - an open source implementation of H.264/MPEG -4/AVC format. It has a license called GPL which makes it free to use for anyone, including commercial purposes.
H.265 - a.k.a. HEVC (High Efficiency Video Coding) is the successor to AVC (H.264). It is proprietary and has patents protecting its use and therefore a license must be purchased from the same company MPEG LA. They typically also charge royalties for its use. However, in 2018 MPEG LA said they would no longer charge royalties. It is still patent encumbered regardless.
x265 - an open source implementation for encoding to HEVC/H.265. It has a GPL license and it free to use by anyone
There is other software often used in the video (Plex) world. These include:
VC-1 - Microsoft, not open source, patented, used in Silverlight, Blu-ray, and HD-DVD (remember those?)
VP9 - Google HEVC competitor, used heavily by Youtube as webm. Open source
AV1 - Google’s next attempt to compete with HEVC. Formed a large consortium of very serious companies. Heavily derived from the VP10 codec (which is dead) Open source, patent free, royalty free.