Before Java , creating a simple data class required writing a constructor, getter methods, equals(), hashCode(), and toString(). That is a lot of boilerplate for a class that just holds fields.
A record removes all of that:
public record Point(int x, int y) {}
That single line gives you a constructor, getters (x() and y()), equals(), hashCode(), and toString() for free. Record fields are final, so the object is immutable after creation.
Use records when you need a class whose only job is carrying data. If the class needs mutable state or inheritance, a regular class is still the right choice.