Generics let one piece of code work with many types without losing type safety. List<T> is generic: a List<int> only holds ints, and reading from it needs no cast. You can write your own: a generic method T Largest<T>(IEnumerable<T> items) or a generic class Page<T>. The compiler usually works out T from the arguments, so you call Largest(prices) without writing <decimal>.
Inside generic code you only know what the constraints promise. where T : IComparable<T> lets you call CompareTo; where T : class means a reference type, so T? can be null; where T : new() allows new T(); where T : IEntity lets you read the interface's members. default(T) is null for reference types and zero for numbers.
Since .NET 7, generic math interfaces such as INumber<T> (in System.Numerics) let one method add up ints, decimals or doubles with T.Zero, + and T.CreateChecked(count).
Reach for generics when the logic is the same and only the type changes. If you find yourself writing if (typeof(T) == typeof(int)), the code is probably not really generic.
A generic method with a constraint, called with two different types.