Per Unreal's documentation:
UFunctions
https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/GameplayArchitecture/Functions/
A UFunction is a C++ function that is recognized by the Unreal Engine 4 (UE4) reflection system. Any UObject or Blueprint function library can declare a member function as a UFunction by placing the UFUNCTION macro on the line above the function declaration in the header file. The macro will support Function Specifiers to change how UE4 interprets and uses a function.
UFUNCTION([specifier1=setting1, specifier2, ...], [meta(key1="value1", key2, ...)])
ReturnType FunctionName([Parameter1, Parameter2, ..., ParameterN1=DefaultValueN1, ParameterN2=DefaultValueN2]) [const];
So, in your case...
UFUNCTION() is a macro that marks the function in the Reflection system.
int32 is the return type, a 32bit integer.
AddToInventory is the function name.
AInventoryActor* ActorToAdd is an input parameter.