You have power being dissipated in the junction, that energy flows away thru a thermal resistance which develops a temperature difference between the junction and whatever the other reference point is proportional to the power flow times the thermal resistance, it is just the thermodynamic version of ohms law.
You must contrive to respect all of the maximums, and that usually means that you will not be able to for example run max voltage and max current at the same time without fairly heroic efforts at cooling.
If say the thermal resistance between junction and ambient is 100C/W, and you have a value for Tj(max) of say 175C, then if the ambient temperature is limited to say 40C, you have a thermally imposed power limit of (175 - 40)/100 = 1.35W.
I would further note that you don't generally want to be anywhere near the maximum junction temperature as that hurts reliability.
Be very careful about the numbers on the first page of the datasheet, these are usually written by marketing slime rather then engineers, and while not wrong exactly usually do things like giving mosfet ratings at 25C case temperature, and Rds(on) ratings at 25C junction temperature, yes, mosfet vendors looking at YOU. The real usually starts on page 2 or so.